diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..fbd02a7 --- /dev/null +++ b/License.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Kony + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/SegementAnimation/.project b/SegementAnimation/.project new file mode 100644 index 0000000..c1bb185 --- /dev/null +++ b/SegementAnimation/.project @@ -0,0 +1,12 @@ + + + SegementAnimation + + + + + + + com.pat.tool.keditor.nature.kprojectnature + + diff --git a/SegementAnimation/_clouddata/web.xml b/SegementAnimation/_clouddata/web.xml new file mode 100644 index 0000000..e69de29 diff --git a/SegementAnimation/ant-contrib-0.6.jar b/SegementAnimation/ant-contrib-0.6.jar new file mode 100644 index 0000000..db90b0a Binary files /dev/null and b/SegementAnimation/ant-contrib-0.6.jar differ diff --git a/SegementAnimation/appSettings.xml b/SegementAnimation/appSettings.xml new file mode 100644 index 0000000..5a334cc --- /dev/null +++ b/SegementAnimation/appSettings.xml @@ -0,0 +1 @@ +commontruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetrue \ No newline at end of file diff --git a/SegementAnimation/build.properties b/SegementAnimation/build.properties new file mode 100644 index 0000000..c47b70f --- /dev/null +++ b/SegementAnimation/build.properties @@ -0,0 +1,112 @@ +#Note: Please escape '\' with '\\' in all file paths# +project.name=SegementAnimation + +#mode 0-Build; 1-Publish; 2-Build & Publish; 3-Combine Web Application+Kony Server Archive; 4-Build & Combine Web Application+Kony Server Archive; +#mode-0: Application will be built for the selected build platforms +#mode-1: Based on publish.web, publish.service properties, app will be published & services will be published +#mode-2: Application will be built for selected build platforms and publish will be performed. +#mode-3: Combines web archive of app & kony server archive and generates combined war/ear file +#mode-4: Application will be built & Generated web archive will be combined with Kony server archive and final war/ear will be generated +mode=0 + +#Application details +appid=SegAnimation +version=1.0.0 +map_google_key= +default_locale= +android.packagename=com.kony.SegmentAnimation + +#Cloud credentials (Applicable only for cloud) +cloud.username= +cloud.password= + +#Build app for below platforms +iphone=false +android=false +windowsphone8=false +windowsphone81s=false + +windows8.1=false +windows8.1x86=false +windows8.1arm=false +windows8.1x64=false + +ipad=false +androidtablet=false + +desktop_kiosk=false +desktopweb=false + +spa.iphone=false +spa.android=false +spa.blackberry=false +spa.winphone=false + +spa.ipad=false +spa.androidtablet=false +spa.windowstablet=false + + +#middleware server properties +middleware_server_ip=192.168.56.1 +middleware_http_port=80 +middleware_https_port=443 +#used in cloud mode +cloud.middleware.url= + + +middleware_web_context=middleware +mobileweb_web_context=SegementAnimation + +#build mode [release | debug] +build.mode=release +remove.print.statements=true + +#If not specified, by default final binaries will be copied to 'binaries' folder inside project +binaries.location= + +#On premise publish parameters +Konyserver.publish.url= +Konyserver.publish.service=false +Konyserver.publish.web=false +#Kony server credentials +Konyserver.publish.username= +#Possible values are true/false +Konyserver.publish.password.encrypted=false +Konyserver.publish.password= + +# Cloud publish parameters. Applicable for mode = 1 or 2 # Base url used for publishing example of the format http://accounts.konycloud.com/api/v1_0/environments// +cloud.publish.url= +cloud.publish.app=false +cloud.publish.service=false +cloud.publish.sync=false +# Location of sync interceptor jar file to be published when sync option is true +# Separate with semicolon(;) if there are muliple jars +cloud.publish.sync.file= + +#Combine Web Application+Kony Server Archive. Applicable for mode = 3 or 4 # +#Full path of middleware archive (war/ear).If project has Kony session Manager, +#provide with-cache archive, for Http session Manager, provide without-cache archive. +combinewar.middlewarearchive= +combinewar.context= +#combinewar.war,combinewar.ear are mutually exclusive(Only one of them should be true) +combinewar.war=false +combinewar.ear=false +#Provide full path of dependant libraries,Separate with semicolon(;) if there are multiple libraries +combinewar.dependencylibraries= + +# Generate IPA +mac.ipaddress= +mac.username= +mac.password= + +#Possible value Ex: provisioning.profile= KonyLaunchpadPush(com.kone.containerapp) +provisioning.profile= +keychain.password= +codesign.identity= + +#Possible values are true/false +genipaiphone=false +genipaipad=false + + diff --git a/SegementAnimation/build.xml b/SegementAnimation/build.xml new file mode 100644 index 0000000..5fc6478 --- /dev/null +++ b/SegementAnimation/build.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SegementAnimation/context.properties b/SegementAnimation/context.properties new file mode 100644 index 0000000..e1baa6a --- /dev/null +++ b/SegementAnimation/context.properties @@ -0,0 +1 @@ +#Tue Oct 27 16:34:55 IST 2015 diff --git a/SegementAnimation/defaults/defaults.properties b/SegementAnimation/defaults/defaults.properties new file mode 100644 index 0000000..d76bbca --- /dev/null +++ b/SegementAnimation/defaults/defaults.properties @@ -0,0 +1,6 @@ +# +#Tue Oct 27 16:34:55 IST 2015 +KForm.win_transitionMode=Parallel +KForm.win_outtransition=Slide +KForm.win_intransition=Slide +KForm.win_animateheaderfooter=false diff --git a/SegementAnimation/forms/mobile/Form00a240e66adfc4e.sm/Button0ce1d574251ee4e.json b/SegementAnimation/forms/mobile/Form00a240e66adfc4e.sm/Button0ce1d574251ee4e.json new file mode 100644 index 0000000..a434a75 --- /dev/null +++ b/SegementAnimation/forms/mobile/Form00a240e66adfc4e.sm/Button0ce1d574251ee4e.json @@ -0,0 +1,49 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "50dp" + }, + "_left_": { + "type": "string", + "value": "42dp" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_skin_": "s6d535603ce146388ebc34afc428e69a", + "_text_": "Button", + "_top_": { + "type": "string", + "value": "98dp" + }, + "_width_": { + "type": "string", + "value": "260dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s4e0322e4f174715887416830e0a11a1", + "id": "Button0ce1d574251ee4e", + "ide_onClick": "AS_Button_22e8acb8adc447c6af2cf12b3878f275", + "info": null, + "isvisible": true, + "kuid": "a0befb19ac844649bcc9e5a1cc7df446", + "name": "kony.ui.Button", + "parent": "Form00a240e66adfc4e", + "pf": "Form00a240e66adfc4e", + "wType": "Button" +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/Form00a240e66adfc4e.sm/Form00a240e66adfc4e.json b/SegementAnimation/forms/mobile/Form00a240e66adfc4e.sm/Form00a240e66adfc4e.json new file mode 100644 index 0000000..ac28eed --- /dev/null +++ b/SegementAnimation/forms/mobile/Form00a240e66adfc4e.sm/Form00a240e66adfc4e.json @@ -0,0 +1,111 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_orientation_": 1, + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_percent_": true, + "_skin_": "s3f768fd25ab44b297054cc4d6ed59a4", + "_title_": null, + "addWidgetsdone": false, + "allboxes": [], + "canUpdateUI": true, + "children": [ + "Button0ce1d574251ee4e" + ], + "containerweight": 100, + "currentLocale": null, + "desktopweb": { + "needAppMenu": false + }, + "device": "iPhone6", + "displayorientation": 1, + "enabledforidletimeout": false, + "id": "Form00a240e66adfc4e", + "info": null, + "initdone": false, + "inputaccessoryviewtype": { + "desktopweb": { + "needAppMenu": false + }, + "ipad": { + "psp": { + "inputAccessoryViewType": 4 + } + }, + "iphone": { + "psp": { + "inputAccessoryViewType": 4, + "titleBarConfig": { + "buttonClosureLeftSideView": "", + "buttonClosureRightSideView": "", + "buttonText": "Edit", + "leftButtonText": "Back", + "leftTitle": "Back", + "prevFormTitle": false, + "renderTitleText": true, + "rightTitle": "Edit", + "titleBarLeftSideView": "button", + "titleBarRightSideView": "button", + "titleClosureLeftSideView": "", + "titleClosureRightSideView": "", + "visible": true + } + }, + "titleBar": true + } + }, + "ipad": { + "psp": { + "inputAccessoryViewType": 4 + } + }, + "iphone": { + "psp": { + "inputAccessoryViewType": 4, + "titleBarConfig": { + "buttonClosureLeftSideView": "", + "buttonClosureRightSideView": "", + "buttonText": "Edit", + "leftButtonText": "Back", + "leftTitle": "Back", + "prevFormTitle": false, + "renderTitleText": true, + "rightTitle": "Edit", + "titleBarLeftSideView": "button", + "titleBarRightSideView": "button", + "titleClosureLeftSideView": "", + "titleClosureRightSideView": "", + "visible": true + } + }, + "titleBar": true + }, + "isvisible": true, + "kuid": "cd0622d57cea4aa5a0e9fd618fc4dda5", + "layouttype": 2, + "name": "kony.ui.Form2", + "needappmenu": true, + "paddinginpixel": false, + "platform": "iphone", + "prevDevice": "iPhone6", + "prevPlatform": "iphone", + "retainscrollposition": false, + "shellCSS": "iOS_iPhone6", + "snapgridsize": 10, + "snaptogrid": true, + "titleBarSkin": "sa1f21944341431ebbcaa9421c715af9", + "titlebar": true, + "type": 3, + "wType": "Form" +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/CopyLabel0322dbd3661fd43.json b/SegementAnimation/forms/mobile/frmDetails.sm/CopyLabel0322dbd3661fd43.json new file mode 100644 index 0000000..8bc05bb --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/CopyLabel0322dbd3661fd43.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_bottom_": { + "type": "string", + "value": "0%" + }, + "_height_": { + "type": "string", + "value": "1dp" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd22ede19b9441fa85f8bb2d65c0ebce", + "_text_": "", + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "CopyLabel0322dbd3661fd43", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "1ebd5dfe5cb24012b0348354474da6d0", + "name": "kony.ui.Label", + "parent": "fcResDetailsContainer", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/CopyLabel06c60a4883e2f45.json b/SegementAnimation/forms/mobile/frmDetails.sm/CopyLabel06c60a4883e2f45.json new file mode 100644 index 0000000..27c716e --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/CopyLabel06c60a4883e2f45.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_bottom_": { + "type": "string", + "value": "0%" + }, + "_height_": { + "type": "string", + "value": "1px" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd22ede19b9441fa85f8bb2d65c0ebce", + "_text_": "", + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "CopyLabel06c60a4883e2f45", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "2698539902964c71a9e453fb70e6074c", + "name": "kony.ui.Label", + "parent": "fcCost", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCuisinesDetails0b742884ef22f43.json b/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCuisinesDetails0b742884ef22f43.json new file mode 100644 index 0000000..83f2126 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCuisinesDetails0b742884ef22f43.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "50%" + }, + "_left_": { + "type": "string", + "value": "-0.01%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s6dad682e2fb4e42845eb92adab3e68e", + "_text_": "Rs. 1250 for 2 people", + "_top_": { + "type": "string", + "value": "50.00%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 1, + "enabled": false, + "id": "CopylblCuisinesDetails0b742884ef22f43", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "d1abecdc7d2c495492d726cefb38c69c", + "name": "kony.ui.Label", + "parent": "fcCost", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCusines0386b0e110fbf40.json b/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCusines0386b0e110fbf40.json new file mode 100644 index 0000000..4f76392 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCusines0386b0e110fbf40.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "25%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s640691191cd482cbd666d5c184bdb4f", + "_text_": "Address", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "50%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "CopylblCusines0386b0e110fbf40", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "c67df7d969ff4041b5d92bf267b64dab", + "name": "kony.ui.Label", + "parent": "fcAddress", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCusines0e87c021cdaac4c.json b/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCusines0e87c021cdaac4c.json new file mode 100644 index 0000000..7c14d05 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/CopylblCusines0e87c021cdaac4c.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "50%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s640691191cd482cbd666d5c184bdb4f", + "_text_": "Cost", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "CopylblCusines0e87c021cdaac4c", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "d1b5b1deead04b62b4311a30d2f42218", + "name": "kony.ui.Label", + "parent": "fcCost", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/FlexContainer01dc4e76c44b04f.json b/SegementAnimation/forms/mobile/frmDetails.sm/FlexContainer01dc4e76c44b04f.json new file mode 100644 index 0000000..9b524bb --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/FlexContainer01dc4e76c44b04f.json @@ -0,0 +1,59 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "86%" + }, + "_left_": { + "type": "string", + "value": "0dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s9bf40c1918e452ba896b3f9fc73bef9", + "_top_": { + "type": "string", + "value": "16%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "fcResDetailsContainer" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "FlexContainer01dc4e76c44b04f", + "info": null, + "isvisible": true, + "kuid": "b04578941dad4033ad003636c33e2286", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "fcResDetails", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/Label07788dc95418f42.json b/SegementAnimation/forms/mobile/frmDetails.sm/Label07788dc95418f42.json new file mode 100644 index 0000000..bc4c574 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/Label07788dc95418f42.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_bottom_": { + "type": "string", + "value": "0%" + }, + "_height_": { + "type": "string", + "value": "1dp" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd22ede19b9441fa85f8bb2d65c0ebce", + "_text_": "", + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "Label07788dc95418f42", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "3fe4bc099b85468d8179f00c9f1b30bf", + "name": "kony.ui.Label", + "parent": "fcCuisins", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/btnBack.json b/SegementAnimation/forms/mobile/frmDetails.sm/btnBack.json new file mode 100644 index 0000000..1e76299 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/btnBack.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "40%" + }, + "_left_": { + "type": "string", + "value": "7dp" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd2728eeba0d4770a5cdfd653687dc21", + "_text_": "", + "_top_": { + "type": "string", + "value": "32%" + }, + "_width_": { + "type": "string", + "value": "70dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "sd2728eeba0d4770a5cdfd653687dc21", + "id": "btnBack", + "ide_onClick": "AS_Button_0db48114e4724fdfa4ee4aa816e9b983", + "info": null, + "isvisible": true, + "kuid": "0aca4a1e976546eba1f7fe3119d69944", + "name": "kony.ui.Button", + "onclick": "AS_Button_0db48114e4724fdfa4ee4aa816e9b983", + "parent": "fcTitle", + "pf": "frmDetails", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/btnFavorite.json b/SegementAnimation/forms/mobile/frmDetails.sm/btnFavorite.json new file mode 100644 index 0000000..2ecb17b --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/btnFavorite.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "65%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s209df1dae6345d1bd092598c8aefefe", + "_text_": "", + "_width_": { + "type": "string", + "value": "62%" + }, + "canUpdateUI": true, + "centerx": { + "type": "string", + "value": "50%" + }, + "centery": { + "type": "string", + "value": "50%" + }, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s209df1dae6345d1bd092598c8aefefe", + "id": "btnFavorite", + "ide_onClick": "AS_Button_7b8cc19147914893a980985460699502", + "info": null, + "isvisible": true, + "kuid": "91eafc2d839d40f4be53812d094cda2e", + "name": "kony.ui.Button", + "onclick": "AS_Button_7b8cc19147914893a980985460699502", + "parent": "fcBtnFavorite", + "pf": "frmDetails", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/btnLogout.json b/SegementAnimation/forms/mobile/frmDetails.sm/btnLogout.json new file mode 100644 index 0000000..c3515f4 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/btnLogout.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "40%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "7dp" + }, + "_skin_": "s7fcaddf95a142beb8775f2a55566133", + "_text_": "", + "_top_": { + "type": "string", + "value": "32%" + }, + "_width_": { + "type": "string", + "value": "70dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s7fcaddf95a142beb8775f2a55566133", + "id": "btnLogout", + "ide_onClick": "AS_Button_80b8d034a55549c5ae72f76855cbf8ff", + "info": null, + "isvisible": true, + "kuid": "174a6f9b90fe4d1193b55ba143328ae1", + "name": "kony.ui.Button", + "onclick": "AS_Button_80b8d034a55549c5ae72f76855cbf8ff", + "parent": "fcTitle", + "pf": "frmDetails", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/btnMap.json b/SegementAnimation/forms/mobile/frmDetails.sm/btnMap.json new file mode 100644 index 0000000..0a7763f --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/btnMap.json @@ -0,0 +1,52 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "30%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "3.2699999999999996%" + }, + "_skin_": "s4421c4ead6b4206af0a6d250d683745", + "_text_": "", + "_top_": { + "type": "string", + "value": "3dp" + }, + "_width_": { + "type": "string", + "value": "50dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s4e0322e4f174715887416830e0a11a1", + "id": "btnMap", + "info": null, + "isvisible": true, + "kuid": "0566e69c4bbb47f981837989e4eb750b", + "name": "kony.ui.Button", + "parent": "fcAddress", + "pf": "frmDetails", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/btnRate.json b/SegementAnimation/forms/mobile/frmDetails.sm/btnRate.json new file mode 100644 index 0000000..8f79451 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/btnRate.json @@ -0,0 +1,52 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "65%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s5caf4d408bb44edbb82b91e6ff8dc11", + "_text_": "", + "_width_": { + "type": "string", + "value": "62%" + }, + "canUpdateUI": true, + "centerx": { + "type": "string", + "value": "50%" + }, + "centery": { + "type": "string", + "value": "50%" + }, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s5caf4d408bb44edbb82b91e6ff8dc11", + "id": "btnRate", + "info": null, + "isvisible": true, + "kuid": "122864c88ff24e828d87a12a49ca9875", + "name": "kony.ui.Button", + "parent": "fcBtnrate", + "pf": "frmDetails", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcAddress.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcAddress.json new file mode 100644 index 0000000..9c70a90 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcAddress.json @@ -0,0 +1,60 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "49%" + }, + "_left_": { + "type": "string", + "value": "3%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4f017ed309a499eb0c21235e28f53dd", + "_top_": { + "type": "string", + "value": "51%" + }, + "_width_": { + "type": "string", + "value": "97%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "CopylblCusines0386b0e110fbf40", + "lblAddress", + "btnMap" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcAddress", + "info": null, + "isvisible": true, + "kuid": "7a0bd72247c24f8787368f8dd132efb2", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "fcResDetailsContainer", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcBtnFavorite.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcBtnFavorite.json new file mode 100644 index 0000000..c1c23ac --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcBtnFavorite.json @@ -0,0 +1,59 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "13%" + }, + "_left_": { + "type": "string", + "value": "50.50%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s523746e0aab4a629989ea5bb38588ca", + "_top_": { + "type": "string", + "value": "2.69%" + }, + "_width_": { + "type": "string", + "value": "49.50%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "btnFavorite" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcBtnFavorite", + "info": null, + "isvisible": true, + "kuid": "6bc9048fcb9e42eca61b1b5dc4c6726f", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "fcResDetails", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcBtnrate.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcBtnrate.json new file mode 100644 index 0000000..1d51c9a --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcBtnrate.json @@ -0,0 +1,59 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "13%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "se5b17d84ae74516bb73601eaa03efd1", + "_top_": { + "type": "string", + "value": "2.68%" + }, + "_width_": { + "type": "string", + "value": "49.50%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "btnRate" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcBtnrate", + "info": null, + "isvisible": true, + "kuid": "20fb6cc6a02a46d4972252d0497454fe", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "fcResDetails", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcCost.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcCost.json new file mode 100644 index 0000000..9da0750 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcCost.json @@ -0,0 +1,60 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "25%" + }, + "_left_": { + "type": "string", + "value": "3%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4f017ed309a499eb0c21235e28f53dd", + "_top_": { + "type": "string", + "value": "25%" + }, + "_width_": { + "type": "string", + "value": "97%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "CopylblCusines0e87c021cdaac4c", + "CopylblCuisinesDetails0b742884ef22f43", + "CopyLabel06c60a4883e2f45" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcCost", + "info": null, + "isvisible": true, + "kuid": "87fedb3c0ea04b4ab2d1ded069ff9e71", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "fcResDetailsContainer", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcCuisins.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcCuisins.json new file mode 100644 index 0000000..2c06d1c --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcCuisins.json @@ -0,0 +1,60 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "25%" + }, + "_left_": { + "type": "string", + "value": "3%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4f017ed309a499eb0c21235e28f53dd", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "lblCusines", + "lblCuisinesDetails", + "Label07788dc95418f42" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcCuisins", + "info": null, + "isvisible": true, + "kuid": "59c86d96397742e393708f5432d537ae", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "fcResDetailsContainer", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcFrmDetailsContainer.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcFrmDetailsContainer.json new file mode 100644 index 0000000..727fda3 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcFrmDetailsContainer.json @@ -0,0 +1,63 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "91%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4f017ed309a499eb0c21235e28f53dd", + "_top_": { + "type": "string", + "value": "9%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "imgRestaurent", + "lblResName", + "lblResAdd", + "lblRating", + "fcResDetails" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcFrmDetailsContainer", + "info": null, + "isvisible": true, + "kuid": "9b5d50afc9a147eeafaf4fe90038fa9d", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmDetails", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcResDetails.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcResDetails.json new file mode 100644 index 0000000..d25afc9 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcResDetails.json @@ -0,0 +1,61 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "70%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s124443cda9b4ef0bb37a58dd078d59e", + "_top_": { + "type": "string", + "value": "30%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "fcBtnrate", + "fcBtnFavorite", + "FlexContainer01dc4e76c44b04f" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcResDetails", + "info": null, + "isvisible": true, + "kuid": "e9a448a4adff4c5fb8f4a2ce7ef5fed3", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "fcFrmDetailsContainer", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcResDetailsContainer.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcResDetailsContainer.json new file mode 100644 index 0000000..fb53d22 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcResDetailsContainer.json @@ -0,0 +1,62 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "65%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s35615a574064534b4718407c596bcf1", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "fcCuisins", + "fcCost", + "fcAddress", + "CopyLabel0322dbd3661fd43" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcResDetailsContainer", + "info": null, + "isvisible": true, + "kuid": "fca4ff009420425b821f6cecca69f73a", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "FlexContainer01dc4e76c44b04f", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/fcTitle.json b/SegementAnimation/forms/mobile/frmDetails.sm/fcTitle.json new file mode 100644 index 0000000..1546e31 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/fcTitle.json @@ -0,0 +1,61 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "9%" + }, + "_left_": { + "type": "string", + "value": "0px" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s9ec461af5054f12aacda4e3128c37b7", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "lblTitle", + "btnBack", + "btnLogout" + ], + "clipbounds": false, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcTitle", + "info": null, + "isvisible": true, + "kuid": "f6bc5fe63c9b4122aac7bbb46b34eb84", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmDetails", + "percent": true, + "pf": "frmDetails", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/frmDetails.json b/SegementAnimation/forms/mobile/frmDetails.sm/frmDetails.json new file mode 100644 index 0000000..77ba512 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/frmDetails.json @@ -0,0 +1,113 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4c239ca064c41f29fafc526d710bcd6", + "_title_": "Details", + "addWidgetsdone": false, + "allboxes": [], + "android": { + "needAppMenu": false + }, + "canUpdateUI": true, + "children": [ + "fcTitle", + "fcFrmDetailsContainer" + ], + "containerweight": 100, + "contentoffsetx": 0, + "contentoffsety": 0, + "contentsizeheight": 0, + "contentsizewidth": 0, + "currentLocale": null, + "desktopweb": { + "needAppMenu": false + }, + "device": "GalaxyS5", + "disabledSkins": { + "menuNormalSkin": "s022080a14dd40cda4e250c21494af71" + }, + "displayorientation": 1, + "enabled": false, + "enabledforidletimeout": false, + "id": "frmDetails", + "info": null, + "initdone": false, + "inputaccessoryviewtype": 4, + "ipad": { + "psp": { + "inputAccessoryViewType": 4 + } + }, + "iphone": { + "needAppMenu": false, + "psp": { + "inputAccessoryViewType": 4, + "titleBarConfig": { + "buttonClosureLeftSideView": "", + "buttonClosureRightSideView": "", + "buttonText": "", + "imageLeftSideView": "back.png", + "imageRightSideView": "logout.png", + "leftButtonText": "", + "leftTitle": "Back", + "prevFormTitle": false, + "renderTitleText": true, + "rightTitle": "Edit", + "titleBarLeftSideView": "button", + "titleBarRightSideView": "button", + "titleClosureLeftSideView": "", + "titleClosureRightSideView": "", + "visible": false + } + }, + "titleBar": false + }, + "isvisible": true, + "kuid": "40b26f389604409aa94b1fc472e8be29", + "layouttype": 2, + "name": "kony.ui.Form2", + "needappmenu": true, + "orientation": 1, + "paddinginpixel": false, + "percent": true, + "platform": "android", + "prevDevice": "GalaxyS4", + "prevPlatform": "iphone", + "retainscrollposition": false, + "shellCSS": "and_GalaxyS5", + "snapgridsize": 10, + "snaptogrid": true, + "spaan": { + "needAppMenu": false + }, + "spabb": { + "needAppMenu": false + }, + "spaip": { + "needAppMenu": false + }, + "spawinphone8": { + "needAppMenu": false + }, + "titleBarSkin": "sf4e9c0e12b141698a1823eef22b7e95", + "titlebar": false, + "type": 3, + "wType": "Form", + "widgetalignment": 5, + "winphone8": { + "needAppMenu": false + } +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/imgRestaurent.json b/SegementAnimation/forms/mobile/frmDetails.sm/imgRestaurent.json new file mode 100644 index 0000000..efafd73 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/imgRestaurent.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizImage2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_base64_": null, + "_height_": { + "type": "string", + "value": "45%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s7266d3a030f4486ab5b5225a3e8f492", + "_src_": "details_image.png", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "canUpdateUI": true, + "containerweight": 100, + "context": { + "channel": "mobile", + "formID": "frmDetails", + "ispercent": true, + "platform": "android", + "templateType": "forms", + "topLevelBox": null + }, + "enabled": false, + "id": "imgRestaurent", + "imagescalemode": 1, + "info": null, + "invokedProperty": "src", + "ispercent": true, + "isvisible": true, + "kuid": "8035630122ff4d2aa111f69f018b6b7f", + "name": "kony.ui.Image2", + "parent": "fcFrmDetailsContainer", + "pf": "frmDetails", + "srcType": 1, + "wType": "Image", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/lblAddress.json b/SegementAnimation/forms/mobile/frmDetails.sm/lblAddress.json new file mode 100644 index 0000000..7f46949 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/lblAddress.json @@ -0,0 +1,64 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "75%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s6dad682e2fb4e42845eb92adab3e68e", + "_text_": "1st Floor,Building No.36,Pheonix,Madhapur,Hitech City,Hyderabad", + "_top_": { + "type": "string", + "value": "25%" + }, + "_width_": { + "type": "string", + "value": "84.21%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 1, + "enabled": false, + "id": "lblAddress", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "textCopyable": false, + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "67b558a176fd424bb8e5c4f97c355c8b", + "name": "kony.ui.Label", + "parent": "fcAddress", + "pf": "frmDetails", + "textcopyable": false, + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/lblCuisinesDetails.json b/SegementAnimation/forms/mobile/frmDetails.sm/lblCuisinesDetails.json new file mode 100644 index 0000000..7edd2a3 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/lblCuisinesDetails.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "50%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s6dad682e2fb4e42845eb92adab3e68e", + "_text_": "Cafe,Continental", + "_top_": { + "type": "string", + "value": "50%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 1, + "enabled": false, + "id": "lblCuisinesDetails", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "5246a9f9a79347bb8a60e3fb9595bf96", + "name": "kony.ui.Label", + "parent": "fcCuisins", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/lblCusines.json b/SegementAnimation/forms/mobile/frmDetails.sm/lblCusines.json new file mode 100644 index 0000000..08837a9 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/lblCusines.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "50%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s640691191cd482cbd666d5c184bdb4f", + "_text_": "Cuisines", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "lblCusines", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "0cc454d61a41482cba35dba9da7f7b86", + "name": "kony.ui.Label", + "parent": "fcCuisins", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/lblRating.json b/SegementAnimation/forms/mobile/frmDetails.sm/lblRating.json new file mode 100644 index 0000000..a566d55 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/lblRating.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "4%" + }, + "_left_": { + "type": "string", + "value": "15dp" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s56fc185c4d94b5d8275c5784733327a", + "_text_": "4.6", + "_top_": { + "type": "string", + "value": "115dp" + }, + "_width_": { + "type": "string", + "value": "8%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "enabled": false, + "id": "lblRating", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "e919aba6fee1447e816a5268c4aae616", + "name": "kony.ui.Label", + "parent": "fcFrmDetailsContainer", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/lblResAdd.json b/SegementAnimation/forms/mobile/frmDetails.sm/lblResAdd.json new file mode 100644 index 0000000..16e635a --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/lblResAdd.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_left_": { + "type": "string", + "value": "15dp" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd9ad9741a874054b9afe4e58a4fa01e", + "_text_": "Madhapur", + "_top_": { + "type": "string", + "value": "56dp" + }, + "_width_": { + "type": "string", + "value": "30%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "lblResAdd", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "071a69ce91604a269ff1043b2d0541f7", + "name": "kony.ui.Label", + "parent": "fcFrmDetailsContainer", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/lblResName.json b/SegementAnimation/forms/mobile/frmDetails.sm/lblResName.json new file mode 100644 index 0000000..2012ac7 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/lblResName.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_left_": { + "type": "string", + "value": "15dp" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s0758ad4ce30450481351de40691ef2b", + "_text_": "Label", + "_top_": { + "type": "string", + "value": "27dp" + }, + "_width_": { + "type": "ref", + "value": "preferred" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "lblResName", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "5aac7f895fea48e4a5b4d2f0df8a5ed1", + "name": "kony.ui.Label", + "parent": "fcFrmDetailsContainer", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmDetails.sm/lblTitle.json b/SegementAnimation/forms/mobile/frmDetails.sm/lblTitle.json new file mode 100644 index 0000000..7d39ddc --- /dev/null +++ b/SegementAnimation/forms/mobile/frmDetails.sm/lblTitle.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s5c84e75663846cbb45ff536a4d1d473", + "_text_": "Details", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "enabled": false, + "id": "lblTitle", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "a726441428fb4a2cb8f767191b7b2aac", + "name": "kony.ui.Label", + "parent": "fcTitle", + "pf": "frmDetails", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmFavorite.sm/btnBack.json b/SegementAnimation/forms/mobile/frmFavorite.sm/btnBack.json new file mode 100644 index 0000000..45511ff --- /dev/null +++ b/SegementAnimation/forms/mobile/frmFavorite.sm/btnBack.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "40%" + }, + "_left_": { + "type": "string", + "value": "7dp" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd2728eeba0d4770a5cdfd653687dc21", + "_text_": "", + "_top_": { + "type": "string", + "value": "32%" + }, + "_width_": { + "type": "string", + "value": "70dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "sd2728eeba0d4770a5cdfd653687dc21", + "id": "btnBack", + "ide_onClick": "AS_Button_604431158ee04a4aa2b804008a9e706b", + "info": null, + "isvisible": true, + "kuid": "6156fdc4286c420e97cda21ce822c860", + "name": "kony.ui.Button", + "onclick": "AS_Button_604431158ee04a4aa2b804008a9e706b", + "parent": "fcTitle", + "pf": "frmFavorite", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmFavorite.sm/btnLogout.json b/SegementAnimation/forms/mobile/frmFavorite.sm/btnLogout.json new file mode 100644 index 0000000..5293c0b --- /dev/null +++ b/SegementAnimation/forms/mobile/frmFavorite.sm/btnLogout.json @@ -0,0 +1,52 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "40%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "7dp" + }, + "_skin_": "s7fcaddf95a142beb8775f2a55566133", + "_text_": "", + "_top_": { + "type": "string", + "value": "32%" + }, + "_width_": { + "type": "string", + "value": "70dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s4e0322e4f174715887416830e0a11a1", + "id": "btnLogout", + "info": null, + "isvisible": false, + "kuid": "18d68b074ac942e9a2e78e38c8ed7880", + "name": "kony.ui.Button", + "parent": "fcTitle", + "pf": "frmFavorite", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmFavorite.sm/fcFrmContainer.json b/SegementAnimation/forms/mobile/frmFavorite.sm/fcFrmContainer.json new file mode 100644 index 0000000..5770538 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmFavorite.sm/fcFrmContainer.json @@ -0,0 +1,59 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "91%" + }, + "_left_": { + "type": "string", + "value": "0dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s9bf40c1918e452ba896b3f9fc73bef9", + "_top_": { + "type": "string", + "value": "9%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "segFavRestaurents" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcFrmContainer", + "info": null, + "isvisible": true, + "kuid": "12b14f8142b04fee9f2909ab5198c6cd", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmFavorite", + "percent": true, + "pf": "frmFavorite", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmFavorite.sm/fcTitle.json b/SegementAnimation/forms/mobile/frmFavorite.sm/fcTitle.json new file mode 100644 index 0000000..56194ee --- /dev/null +++ b/SegementAnimation/forms/mobile/frmFavorite.sm/fcTitle.json @@ -0,0 +1,61 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "9%" + }, + "_left_": { + "type": "string", + "value": "0px" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s9ec461af5054f12aacda4e3128c37b7", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "lblTitle", + "btnBack", + "btnLogout" + ], + "clipbounds": false, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcTitle", + "info": null, + "isvisible": true, + "kuid": "fc318e7f84d94e96ad19f0eb5a66a0aa", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmFavorite", + "percent": true, + "pf": "frmFavorite", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmFavorite.sm/frmFavorite.json b/SegementAnimation/forms/mobile/frmFavorite.sm/frmFavorite.json new file mode 100644 index 0000000..c569c94 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmFavorite.sm/frmFavorite.json @@ -0,0 +1,110 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4c239ca064c41f29fafc526d710bcd6", + "_title_": "Favorites", + "addWidgetsdone": false, + "allboxes": [], + "android": { + "needAppMenu": false + }, + "canUpdateUI": true, + "children": [ + "fcTitle", + "fcFrmContainer" + ], + "containerweight": 100, + "contentoffsetx": 0, + "contentoffsety": 0, + "contentsizeheight": 0, + "contentsizewidth": 0, + "currentLocale": null, + "desktopweb": { + "needAppMenu": false + }, + "device": "GalaxyS5", + "displayorientation": 1, + "enabled": false, + "enabledforidletimeout": false, + "id": "frmFavorite", + "ide_preShow": "AS_Form_7e44589989664a03ba9d3fb4f40ae78d", + "info": null, + "initdone": false, + "inputaccessoryviewtype": 4, + "ipad": { + "psp": { + "inputAccessoryViewType": 4 + } + }, + "iphone": { + "needAppMenu": false, + "psp": { + "inputAccessoryViewType": 4, + "titleBarConfig": { + "buttonClosureLeftSideView": "", + "buttonClosureRightSideView": "", + "buttonText": "Edit", + "leftButtonText": "Back", + "leftTitle": "Back", + "prevFormTitle": false, + "renderTitleText": true, + "rightTitle": "Edit", + "titleBarLeftSideView": "button", + "titleBarRightSideView": "button", + "titleClosureLeftSideView": "", + "titleClosureRightSideView": "", + "visible": false + } + }, + "titleBar": false + }, + "isvisible": true, + "kuid": "b2a3f67b9cc04c0789d3251c370928c9", + "layouttype": 2, + "name": "kony.ui.Form2", + "needappmenu": true, + "orientation": 1, + "paddinginpixel": false, + "percent": true, + "platform": "android", + "preshow": "AS_Form_7e44589989664a03ba9d3fb4f40ae78d", + "prevDevice": "iPhone6", + "prevPlatform": "iphone", + "retainscrollposition": false, + "shellCSS": "and_GalaxyS5", + "snapgridsize": 10, + "snaptogrid": true, + "spaan": { + "needAppMenu": false + }, + "spabb": { + "needAppMenu": false + }, + "spaip": { + "needAppMenu": false + }, + "spawinphone8": { + "needAppMenu": false + }, + "titleBarSkin": "sf4e9c0e12b141698a1823eef22b7e95", + "titlebar": false, + "type": 3, + "wType": "Form", + "widgetalignment": 5, + "winphone8": { + "needAppMenu": false + } +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmFavorite.sm/lblTitle.json b/SegementAnimation/forms/mobile/frmFavorite.sm/lblTitle.json new file mode 100644 index 0000000..3828481 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmFavorite.sm/lblTitle.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s5c84e75663846cbb45ff536a4d1d473", + "_text_": "Favorites", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "enabled": false, + "id": "lblTitle", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "011e43c9e9e24f6090f939443f4a8fee", + "name": "kony.ui.Label", + "parent": "fcTitle", + "pf": "frmFavorite", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmFavorite.sm/segFavRestaurents.json b/SegementAnimation/forms/mobile/frmFavorite.sm/segFavRestaurents.json new file mode 100644 index 0000000..e7df358 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmFavorite.sm/segFavRestaurents.json @@ -0,0 +1,187 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizSegment2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_data_": [ + { + "imgDelete": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "delete.png" + }, + "imgMore": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "more.png" + }, + "imgResIcon": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "img1.png" + }, + "lblLine": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "" + }, + "lblResInfo": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Best Pizza" + }, + "lblResName": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Dominos Pizza" + } + }, + { + "imgDelete": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "delete.png" + }, + "imgMore": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "more.png" + }, + "imgResIcon": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "img2.png" + }, + "lblLine": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "" + }, + "lblResInfo": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Best Pizza" + }, + "lblResName": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Dominos Pizza" + } + }, + { + "imgDelete": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "delete.png" + }, + "imgMore": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "more.png" + }, + "imgResIcon": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "img3.png" + }, + "lblLine": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "" + }, + "lblResInfo": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Best Pizza" + }, + "lblResName": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Dominos Pizza" + } + } + ], + "_enabled_": false, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_indicator_": "none", + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_orientation_": 2, + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_rowtemplateid": "favTemplate", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "autogrowmode": 1, + "canUpdateUI": true, + "containerweight": 100, + "counter": "02", + "focusedindex": null, + "focuseditem": null, + "generatedtemplate": "f165ba8c50e74246ab0800fac978cbd0", + "groupcells": false, + "hasSections": false, + "id": "segFavRestaurents", + "info": null, + "ipad": { + "psp": { + "indicator": "rowselect" + } + }, + "iphone": { + "psp": { + "indicator": "rowselect" + } + }, + "isvisible": true, + "kuid": "fabce769629248eaae3c364023da53b0", + "masterdata": {}, + "name": "kony.ui.SegmentedUI2", + "needpageindicator": true, + "pageoffdotimage": "pageOffDot.png", + "pageondotimage": "pageOnDot.png", + "paginationconfig": { + "position": "bottom" + }, + "parent": "fcFrmContainer", + "pf": "frmFavorite", + "retainselection": false, + "rowTemplateId": "a29bcabb4c6c4bb5b6f38a24217a57f4", + "rowcounter": 2, + "rowfocusskin": "sf73da56dc46443ab1168dd77d3a92c3", + "rowskin": "s1cf81e2c5814641983ca7e23b3eaf61", + "rowtemplate": "FlexContainerFavorite", + "screenlevelwidget": false, + "seccounter": 0, + "sectionHeaderTemplateId": null, + "sectionheaderskin": "s5dcf5786ff140d0a6444670d4071291", + "selectedRows": null, + "selectedState": false, + "selectedindex": null, + "selectedindices": null, + "selecteditems": null, + "selectedsectionindex": 0, + "selectionbehavior": "default", + "separatorcolor": "3c610500", + "separatorrequired": false, + "separatorthickness": 20, + "showscrollbars": false, + "viewtype": "tableview", + "wType": "Segment", + "widgetalignment": 5, + "widgetdatamap": { + "FlexContainerDeleteBtn": "FlexContainerDeleteBtn", + "FlexContainerFavorite": "FlexContainerFavorite", + "FlexContainerMoreBtn": "FlexContainerMoreBtn", + "fcResDetails": "fcResDetails", + "imgDelete": "imgDelete", + "imgMore": "imgMore", + "imgResIcon": "imgResIcon", + "lblLine": "lblLine", + "lblResInfo": "lblResInfo", + "lblResName": "lblResName" + } +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/Button0243bef6030b74d.json b/SegementAnimation/forms/mobile/frmHome.sm/Button0243bef6030b74d.json new file mode 100644 index 0000000..09b93d2 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/Button0243bef6030b74d.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "50dp" + }, + "_left_": { + "type": "string", + "value": "50%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s6d535603ce146388ebc34afc428e69a", + "_text_": "Remove", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "50%" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s4e0322e4f174715887416830e0a11a1", + "id": "Button0243bef6030b74d", + "ide_onClick": "AS_Button_1d68940a89594958a42bacc12f78bb08", + "info": null, + "isvisible": true, + "kuid": "375f8fc7586d46bc9221a9c9c848d79b", + "name": "kony.ui.Button", + "onclick": "AS_Button_1d68940a89594958a42bacc12f78bb08", + "parent": "FlexContainer0ccecc465000a43", + "pf": "frmHome", + "wType": "Button", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/Button077b6130fce3d46.json b/SegementAnimation/forms/mobile/frmHome.sm/Button077b6130fce3d46.json new file mode 100644 index 0000000..afac6ce --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/Button077b6130fce3d46.json @@ -0,0 +1,53 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "50dp" + }, + "_left_": { + "type": "string", + "value": "0dp" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s6d535603ce146388ebc34afc428e69a", + "_text_": "Add", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "50%" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s4e0322e4f174715887416830e0a11a1", + "id": "Button077b6130fce3d46", + "ide_onClick": "AS_Button_dbf5be30e7b5481ca6c50234170f4002", + "info": null, + "isvisible": true, + "kuid": "246fad06b7b24167a8302f6420296fc5", + "name": "kony.ui.Button", + "onclick": "AS_Button_dbf5be30e7b5481ca6c50234170f4002", + "parent": "FlexContainer0ccecc465000a43", + "pf": "frmHome", + "wType": "Button", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/FlexContainer0ccecc465000a43.json b/SegementAnimation/forms/mobile/frmHome.sm/FlexContainer0ccecc465000a43.json new file mode 100644 index 0000000..e3f0c47 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/FlexContainer0ccecc465000a43.json @@ -0,0 +1,60 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "10%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4f017ed309a499eb0c21235e28f53dd", + "_top_": { + "type": "string", + "value": "90%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "Button077b6130fce3d46", + "Button0243bef6030b74d" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "FlexContainer0ccecc465000a43", + "info": null, + "isvisible": false, + "kuid": "21aad5a5aba645bd95dbed4700c9b3d0", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmHome", + "percent": true, + "pf": "frmHome", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/btnFavorites.json b/SegementAnimation/forms/mobile/frmHome.sm/btnFavorites.json new file mode 100644 index 0000000..b1c0a4c --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/btnFavorites.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "40%" + }, + "_left_": { + "type": "string", + "value": "7dp" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sdd47edd6a7e432cac77a6db8b170ee3", + "_text_": "", + "_top_": { + "type": "string", + "value": "32%" + }, + "_width_": { + "type": "string", + "value": "70dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "sdd47edd6a7e432cac77a6db8b170ee3", + "id": "btnFavorites", + "ide_onClick": "AS_Button_b6b561388e5942b285974b7aaf09ab9f", + "info": null, + "isvisible": true, + "kuid": "4067f855096c40b79e23d66dd97f5bcc", + "name": "kony.ui.Button", + "onclick": "AS_Button_b6b561388e5942b285974b7aaf09ab9f", + "parent": "fcTitle", + "pf": "frmHome", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/btnLogout.json b/SegementAnimation/forms/mobile/frmHome.sm/btnLogout.json new file mode 100644 index 0000000..f203fee --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/btnLogout.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "40%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "7dp" + }, + "_skin_": "s7fcaddf95a142beb8775f2a55566133", + "_text_": "", + "_top_": { + "type": "string", + "value": "32%" + }, + "_width_": { + "type": "string", + "value": "70dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s7fcaddf95a142beb8775f2a55566133", + "id": "btnLogout", + "ide_onClick": "AS_Button_ccf20d6307034e66891dbd30f65a3d7e", + "info": null, + "isvisible": true, + "kuid": "ab4a7d436f934029858af8629d527809", + "name": "kony.ui.Button", + "onclick": "AS_Button_ccf20d6307034e66891dbd30f65a3d7e", + "parent": "fcTitle", + "pf": "frmHome", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/fcTitle.json b/SegementAnimation/forms/mobile/frmHome.sm/fcTitle.json new file mode 100644 index 0000000..976d42d --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/fcTitle.json @@ -0,0 +1,61 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "9%" + }, + "_left_": { + "type": "string", + "value": "0px" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s9ec461af5054f12aacda4e3128c37b7", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "lblTitle", + "btnFavorites", + "btnLogout" + ], + "clipbounds": false, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcTitle", + "info": null, + "isvisible": true, + "kuid": "1b236c29258246b5b2a57d0f9a47afda", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmHome", + "percent": true, + "pf": "frmHome", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/frmHome.json b/SegementAnimation/forms/mobile/frmHome.sm/frmHome.json new file mode 100644 index 0000000..78a47db --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/frmHome.json @@ -0,0 +1,117 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4c239ca064c41f29fafc526d710bcd6", + "_title_": "Home", + "addWidgetsdone": false, + "allboxes": [], + "android": { + "needAppMenu": false + }, + "canUpdateUI": true, + "children": [ + "fcTitle", + "segmentRestaurentList", + "FlexContainer0ccecc465000a43" + ], + "containerweight": 100, + "contentoffsetx": 0, + "contentoffsety": 0, + "contentsizeheight": 0, + "contentsizewidth": 0, + "currentLocale": null, + "desktopweb": { + "needAppMenu": false + }, + "device": "GalaxyS5", + "displayorientation": 1, + "enabled": false, + "enabledforidletimeout": false, + "id": "frmHome", + "ide_postShow": "AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4", + "ide_preShow": "AS_Form_9668d973e74e4b14b3ed226faa287aa5", + "info": null, + "initdone": false, + "inputaccessoryviewtype": 4, + "ipad": { + "psp": { + "inputAccessoryViewType": 4 + } + }, + "iphone": { + "needAppMenu": false, + "psp": { + "inputAccessoryViewType": 4, + "titleBarConfig": { + "buttonClosureLeftSideView": "", + "buttonClosureRightSideView": "", + "buttonText": "", + "ide_buttonClosureLeftSideView": "AS_TitleBar_f32cc18519a749a59bb578c932852e95", + "ide_buttonClosureRightSideView": "AS_TitleBar_030774e7928a4470868971424d994218", + "imageLeftSideView": "favorites.png", + "imageRightSideView": "logout.png", + "leftButtonText": "", + "leftTitle": "Back", + "prevFormTitle": false, + "renderTitleText": true, + "rightTitle": "Edit", + "titleBarLeftSideView": "button", + "titleBarRightSideView": "button", + "titleClosureLeftSideView": "", + "titleClosureRightSideView": "", + "visible": false + } + }, + "titleBar": false + }, + "isvisible": true, + "kuid": "37680ca2c04e4806a51d8d2b12f736eb", + "layouttype": 2, + "name": "kony.ui.Form2", + "needappmenu": true, + "orientation": 1, + "paddinginpixel": false, + "percent": true, + "platform": "android", + "postshow": "AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4", + "preshow": "AS_Form_9668d973e74e4b14b3ed226faa287aa5", + "prevDevice": "iPhone5", + "prevPlatform": "iphone", + "retainscrollposition": false, + "shellCSS": "and_GalaxyS5", + "snapgridsize": 10, + "snaptogrid": true, + "spaan": { + "needAppMenu": false + }, + "spabb": { + "needAppMenu": false + }, + "spaip": { + "needAppMenu": false + }, + "spawinphone8": { + "needAppMenu": false + }, + "titleBarSkin": "sf4e9c0e12b141698a1823eef22b7e95", + "titlebar": false, + "type": 3, + "wType": "Form", + "widgetalignment": 5, + "winphone8": { + "needAppMenu": false + } +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/lblTitle.json b/SegementAnimation/forms/mobile/frmHome.sm/lblTitle.json new file mode 100644 index 0000000..5c5544d --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/lblTitle.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "0.00%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s5c84e75663846cbb45ff536a4d1d473", + "_text_": "Home", + "_top_": { + "type": "string", + "value": "0.20%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "enabled": false, + "id": "lblTitle", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "d6768a7485d44c96bcb8e50bb107cf5e", + "name": "kony.ui.Label", + "parent": "fcTitle", + "pf": "frmHome", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmHome.sm/segmentRestaurentList.json b/SegementAnimation/forms/mobile/frmHome.sm/segmentRestaurentList.json new file mode 100644 index 0000000..8ba4485 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmHome.sm/segmentRestaurentList.json @@ -0,0 +1,126 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizSegment2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_data_": [ + { + "imgResIcon": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "imagedrag.png" + }, + "lblLine": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "" + }, + "lblResInfo": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Best Pizza" + }, + "lblResName": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Dominos Pizza" + } + } + ], + "_enabled_": false, + "_height_": { + "type": "string", + "value": "91%" + }, + "_indicator_": "none", + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_orientation_": 2, + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_rowtemplateid": "resTemplate", + "_top_": { + "type": "string", + "value": "9%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "autogrowmode": 0, + "canUpdateUI": true, + "containerweight": 100, + "counter": "00", + "focusedindex": null, + "focuseditem": null, + "generatedtemplate": "30805474319b40bd90bdf015dc789306", + "groupcells": false, + "hasSections": false, + "id": "segmentRestaurentList", + "ide_onRowClick": "AS_Segment_df46bfdce97f4382bcd85438f80ebb5b", + "info": null, + "ipad": { + "psp": { + "indicator": "rowselect" + } + }, + "iphone": { + "psp": { + "indicator": "rowselect", + "searchBy": null, + "showProgressIndicator": false + } + }, + "isvisible": true, + "kuid": "c5380104441b4ec89e122fc2ee31b2c7", + "masterdata": {}, + "name": "kony.ui.SegmentedUI2", + "needpageindicator": true, + "onrowclick": "AS_Segment_df46bfdce97f4382bcd85438f80ebb5b", + "pageoffdotimage": "pageOffDot.png", + "pageondotimage": "pageOnDot.png", + "paginationconfig": { + "position": "bottom" + }, + "parent": "frmHome", + "pf": "frmHome", + "retainselection": false, + "rowTemplateId": "2194f894e8b847eb93ea935ddbf808c7", + "rowcounter": 0, + "rowfocusskin": "s1cf81e2c5814641983ca7e23b3eaf61", + "rowskin": "s1cf81e2c5814641983ca7e23b3eaf61", + "rowtemplate": "fcResDetailfcResDetail", + "screenlevelwidget": false, + "searchBy": "lblResName", + "seccounter": 0, + "sectionheaderskin": "s5dcf5786ff140d0a6444670d4071291", + "selectedRows": null, + "selectedState": false, + "selectedindex": null, + "selectedindices": null, + "selecteditems": null, + "selectedsectionindex": 0, + "selectionbehavior": "default", + "separatorcolor": "c8c7cc64", + "separatorrequired": false, + "separatorthickness": 0, + "showscrollbars": false, + "viewtype": "tableview", + "wType": "Segment", + "widgetalignment": 5, + "widgetdatamap": { + "fcResDetailfcResDetail": "fcResDetailfcResDetail", + "imgResIcon": "imgResIcon", + "lblLine": "lblLine", + "lblResInfo": "lblResInfo", + "lblResName": "lblResName" + } +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/CheckBoxGroup0b0f5d1875e364d.json b/SegementAnimation/forms/mobile/frmLogin.sm/CheckBoxGroup0b0f5d1875e364d.json new file mode 100644 index 0000000..a9f366c --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/CheckBoxGroup0b0f5d1875e364d.json @@ -0,0 +1,101 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizCheckBox", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "120dp" + }, + "_left_": { + "type": "string", + "value": "6%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 4, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s5b2fed8d01b44c0b3ee4216a7a6e9f0", + "_top_": { + "type": "string", + "value": "68%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "android": { + "render": true, + "tickedImage": "check_btn_f.png", + "untickedImage": "check_btn_f.png" + }, + "canUpdateUI": true, + "containerweight": 100, + "groupcells": false, + "id": "CheckBoxGroup0b0f5d1875e364d", + "info": null, + "ipad": { + "psp": { + "viewType": 4 + } + }, + "iphone": { + "psp": { + "viewType": 4 + }, + "render": false + }, + "isvisible": true, + "itemorientation": "vertical", + "kuid": "d6944fa556664e63acfa847cb389b08d", + "masterdata": [ + [ + "cbg1", + "Remember Me" + ] + ], + "name": "kony.ui.CheckBoxGroup", + "orientation": "vertical", + "paddinginpixel": false, + "parent": "loginContainer", + "pf": "frmLogin", + "selectedkey": null, + "selectedkeys": [ + "cbg1" + ], + "selectedkeyvalue": null, + "selectedkeyvalues": [ + [ + "cbg1", + "Remember Me" + ] + ], + "size": 18, + "spaan": { + "render": false + }, + "spabb": { + "render": false + }, + "spaip": { + "render": false + }, + "spawinphone8": { + "render": false + }, + "viewtype": 0, + "wType": "CheckBoxGroup", + "widgetalignment": 5, + "winphone8": { + "render": false + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/CopylblSeparator0ba52bbe93a644a.json b/SegementAnimation/forms/mobile/frmLogin.sm/CopylblSeparator0ba52bbe93a644a.json new file mode 100644 index 0000000..2348a27 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/CopylblSeparator0ba52bbe93a644a.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "60%" + }, + "_left_": { + "type": "string", + "value": "16%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s04e5a267fa94758804e482dee84c71a", + "_text_": "", + "_top_": { + "type": "string", + "value": "20%" + }, + "_width_": { + "type": "string", + "value": "1px" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "CopylblSeparator0ba52bbe93a644a", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "edf466299a964dea804aaa45a7e5e522", + "name": "kony.ui.Label", + "parent": "fcUserPswd", + "pf": "frmLogin", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/Switch03dcb15500a7f43.json b/SegementAnimation/forms/mobile/frmLogin.sm/Switch03dcb15500a7f43.json new file mode 100644 index 0000000..dfd0aeb --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/Switch03dcb15500a7f43.json @@ -0,0 +1,78 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizSwitch", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "0%" + }, + "_skin_": "se5d8a4c61f740409e8c4698805b454b", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "20%" + }, + "android": { + "render": false + }, + "canUpdateUI": true, + "containerweight": 100, + "id": "Switch03dcb15500a7f43", + "info": null, + "iphone": { + "render": true + }, + "isvisible": true, + "kiosk": { + "render": false + }, + "kuid": "21767b117d1e4638888d32b0f1f2e8aa", + "leftsidetext": "ON", + "name": "kony.ui.Switch", + "onslide": null, + "osPlatform": "iphone", + "osVersion": "iOS7", + "parent": "fcSwitch", + "pf": "frmLogin", + "rightsidetext": "OFF", + "selectedindex": 0, + "spaan": { + "render": false + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "wType": "Switch", + "widgetalignment": 5, + "winphone8": { + "render": true + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/btnLogin.json b/SegementAnimation/forms/mobile/frmLogin.sm/btnLogin.json new file mode 100644 index 0000000..94beb07 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/btnLogin.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "8%" + }, + "_left_": { + "type": "string", + "value": "6%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "6%" + }, + "_skin_": "s087bdfb0dc44c83b52049fe9c659880", + "_text_": "LOGIN", + "_top_": { + "type": "string", + "value": "80%" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s087bdfb0dc44c83b52049fe9c659880", + "id": "btnLogin", + "ide_onClick": "AS_Button_ba8009aaff6d48da9c9a68d09def217f", + "info": null, + "isvisible": true, + "kuid": "000221a75e194e948559eb0ab2e10611", + "name": "kony.ui.Button", + "onclick": "AS_Button_ba8009aaff6d48da9c9a68d09def217f", + "parent": "loginContainer", + "pf": "frmLogin", + "wType": "Button", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/fcSwitch.json b/SegementAnimation/forms/mobile/frmLogin.sm/fcSwitch.json new file mode 100644 index 0000000..7817ef1 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/fcSwitch.json @@ -0,0 +1,81 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "10%" + }, + "_left_": { + "type": "string", + "value": "6%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "2%" + }, + "_skin_": "s4f017ed309a499eb0c21235e28f53dd", + "_top_": { + "type": "string", + "value": "68%" + }, + "allboxes": [], + "android": { + "render": false + }, + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "lblSwitch", + "Switch03dcb15500a7f43" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcSwitch", + "info": null, + "iphone": { + "render": true + }, + "isvisible": true, + "kuid": "e6ec2ba9f0494d238399d5c72e007206", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "loginContainer", + "percent": true, + "pf": "frmLogin", + "snapgridsize": 10, + "snaptogrid": true, + "spaan": { + "render": false + }, + "spabb": { + "render": true + }, + "spaip": { + "render": false + }, + "spawinphone8": { + "render": false + }, + "wType": "FlexContainer", + "widgetalignment": 1, + "winphone8": { + "render": false + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/fcUserId.json b/SegementAnimation/forms/mobile/frmLogin.sm/fcUserId.json new file mode 100644 index 0000000..6953aa9 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/fcUserId.json @@ -0,0 +1,61 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "10%" + }, + "_left_": { + "type": "string", + "value": "4%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "4%" + }, + "_skin_": "s2f38d7817d2498c9a7910d8385fca87", + "_top_": { + "type": "string", + "value": "40%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "lblSeparator", + "imgIcon", + "txtBoxUserId" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcUserId", + "info": null, + "isvisible": true, + "kuid": "8e36176ef79a45cabf82c15c28461f18", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "loginContainer", + "percent": true, + "pf": "frmLogin", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/fcUserPswd.json b/SegementAnimation/forms/mobile/frmLogin.sm/fcUserPswd.json new file mode 100644 index 0000000..9e6b551 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/fcUserPswd.json @@ -0,0 +1,61 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "10%" + }, + "_left_": { + "type": "string", + "value": "4%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "4%" + }, + "_skin_": "s2f38d7817d2498c9a7910d8385fca87", + "_top_": { + "type": "string", + "value": "53%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "CopylblSeparator0ba52bbe93a644a", + "imgicon1", + "txtBoxUserPswd" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcUserPswd", + "info": null, + "isvisible": true, + "kuid": "f8f9dfd955764f9387dad8ef5f9f13a0", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "loginContainer", + "percent": true, + "pf": "frmLogin", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/frmLogin.json b/SegementAnimation/forms/mobile/frmLogin.sm/frmLogin.json new file mode 100644 index 0000000..77d0958 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/frmLogin.json @@ -0,0 +1,110 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sdbd55e7cae843d6a4be4c4213bf20bd", + "_title_": null, + "addWidgetsdone": false, + "allboxes": [], + "android": { + "needAppMenu": false + }, + "canUpdateUI": true, + "children": [ + "loginContainer" + ], + "containerweight": 100, + "contentoffsetx": 0, + "contentoffsety": 0, + "contentsizeheight": 0, + "contentsizewidth": 0, + "currentLocale": null, + "desktopweb": { + "needAppMenu": false + }, + "device": "iPhone6", + "displayorientation": 1, + "enabled": false, + "enabledforidletimeout": false, + "id": "frmLogin", + "ide_init": "AS_Form_cc6d3719edab4037807254f5a17c49d2", + "ide_postShow": "AS_Form_24f504db645f4df0a3e742c828e241b5", + "info": null, + "initdone": false, + "inputaccessoryviewtype": 4, + "ipad": { + "psp": { + "inputAccessoryViewType": 4 + } + }, + "iphone": { + "needAppMenu": false, + "psp": { + "inputAccessoryViewType": 4, + "titleBarConfig": { + "buttonClosureLeftSideView": "", + "buttonClosureRightSideView": "", + "buttonText": "Edit", + "leftButtonText": "Back", + "leftTitle": "Back", + "prevFormTitle": false, + "renderTitleText": true, + "rightTitle": "Edit", + "titleBarLeftSideView": "button", + "titleBarRightSideView": "button", + "titleClosureLeftSideView": "", + "titleClosureRightSideView": "", + "visible": false + } + }, + "titleBar": false + }, + "isvisible": true, + "kuid": "412c778f25424689962af76fbfac1efc", + "layouttype": 2, + "name": "kony.ui.Form2", + "needappmenu": true, + "orientation": 1, + "paddinginpixel": false, + "percent": true, + "platform": "iphone", + "postshow": "AS_Form_24f504db645f4df0a3e742c828e241b5", + "prevDevice": "GalaxyS5", + "prevPlatform": "android", + "retainscrollposition": false, + "shellCSS": "iOS_iPhone6", + "snapgridsize": 10, + "snaptogrid": true, + "spaan": { + "needAppMenu": false + }, + "spabb": { + "needAppMenu": false + }, + "spaip": { + "needAppMenu": false + }, + "spawinphone8": { + "needAppMenu": false + }, + "titleBarSkin": "sa1f21944341431ebbcaa9421c715af9", + "titlebar": true, + "type": 3, + "wType": "Form", + "widgetalignment": 5, + "winphone8": { + "needAppMenu": false + } +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/imgIcon.json b/SegementAnimation/forms/mobile/frmLogin.sm/imgIcon.json new file mode 100644 index 0000000..7ea0a29 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/imgIcon.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizImage2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_base64_": null, + "_height_": { + "type": "string", + "value": "50%" + }, + "_left_": { + "type": "string", + "value": "3%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s7266d3a030f4486ab5b5225a3e8f492", + "_src_": "user_icon.png", + "_top_": { + "type": "string", + "value": "25%" + }, + "_width_": { + "type": "string", + "value": "12%" + }, + "canUpdateUI": true, + "containerweight": 100, + "context": { + "channel": "mobile", + "formID": "frmLogin", + "ispercent": true, + "platform": "iphone", + "templateType": "forms", + "topLevelBox": null + }, + "enabled": false, + "id": "imgIcon", + "imagescalemode": 1, + "info": null, + "invokedProperty": "src", + "ispercent": true, + "isvisible": true, + "kuid": "48d84a01dd1b498480e9d6e58e5f381f", + "name": "kony.ui.Image2", + "parent": "fcUserId", + "pf": "frmLogin", + "srcType": 1, + "wType": "Image", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/imgLogo.json b/SegementAnimation/forms/mobile/frmLogin.sm/imgLogo.json new file mode 100644 index 0000000..39b0a24 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/imgLogo.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizImage2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_base64_": null, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_left_": { + "type": "string", + "value": "0dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s7266d3a030f4486ab5b5225a3e8f492", + "_src_": "logo.png", + "_top_": { + "type": "string", + "value": "10%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "canUpdateUI": true, + "containerweight": 100, + "context": { + "channel": "mobile", + "formID": "frmLogin", + "ispercent": true, + "platform": "iphone", + "templateType": "forms", + "topLevelBox": null + }, + "enabled": false, + "id": "imgLogo", + "imagescalemode": 1, + "info": null, + "invokedProperty": "src", + "ispercent": true, + "isvisible": true, + "kuid": "87d201db620c4bf2b499874f3dd0825e", + "name": "kony.ui.Image2", + "parent": "loginContainer", + "pf": "frmLogin", + "srcType": 1, + "wType": "Image", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/imgicon1.json b/SegementAnimation/forms/mobile/frmLogin.sm/imgicon1.json new file mode 100644 index 0000000..570c097 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/imgicon1.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizImage2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_base64_": null, + "_height_": { + "type": "string", + "value": "50%" + }, + "_left_": { + "type": "string", + "value": "3%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s7266d3a030f4486ab5b5225a3e8f492", + "_src_": "login_pass_icon.png", + "_top_": { + "type": "string", + "value": "25%" + }, + "_width_": { + "type": "string", + "value": "12%" + }, + "canUpdateUI": true, + "containerweight": 100, + "context": { + "channel": "mobile", + "formID": "frmLogin", + "ispercent": true, + "platform": "iphone", + "templateType": "forms", + "topLevelBox": null + }, + "enabled": false, + "id": "imgicon1", + "imagescalemode": 1, + "info": null, + "invokedProperty": "src", + "ispercent": true, + "isvisible": true, + "kuid": "4ba52c33103942579f56149902b20601", + "name": "kony.ui.Image2", + "parent": "fcUserPswd", + "pf": "frmLogin", + "srcType": 1, + "wType": "Image", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/lblSeparator.json b/SegementAnimation/forms/mobile/frmLogin.sm/lblSeparator.json new file mode 100644 index 0000000..60b5ac5 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/lblSeparator.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "60%" + }, + "_left_": { + "type": "string", + "value": "16%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s04e5a267fa94758804e482dee84c71a", + "_text_": "", + "_top_": { + "type": "string", + "value": "20%" + }, + "_width_": { + "type": "string", + "value": "1px" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "lblSeparator", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "741a3381331c45e3b68afb0548df29e3", + "name": "kony.ui.Label", + "parent": "fcUserId", + "pf": "frmLogin", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/lblSwitch.json b/SegementAnimation/forms/mobile/frmLogin.sm/lblSwitch.json new file mode 100644 index 0000000..7ae9281 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/lblSwitch.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd9ad9741a874054b9afe4e58a4fa01e", + "_text_": "Remeber Me", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "60%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 1, + "enabled": false, + "id": "lblSwitch", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "d5e66134d775451d88ab3d6da24a26ff", + "name": "kony.ui.Label", + "parent": "fcSwitch", + "pf": "frmLogin", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/lblTitle1.json b/SegementAnimation/forms/mobile/frmLogin.sm/lblTitle1.json new file mode 100644 index 0000000..f4f365f --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/lblTitle1.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s1d944ace0be4558a04188cf0e2f5dbd", + "_text_": "Welcome to", + "_top_": { + "type": "string", + "value": "23%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "enabled": false, + "id": "lblTitle1", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "0b665e9f0e804855b7c7d3baa8908808", + "name": "kony.ui.Label", + "parent": "loginContainer", + "pf": "frmLogin", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/lblTitle2.json b/SegementAnimation/forms/mobile/frmLogin.sm/lblTitle2.json new file mode 100644 index 0000000..31170b6 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/lblTitle2.json @@ -0,0 +1,62 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd9ad9741a874054b9afe4e58a4fa01e", + "_text_": "Sample Application Design", + "_top_": { + "type": "string", + "value": "28%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "enabled": false, + "id": "lblTitle2", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "e8625afee93b4cb4b1e4dac7f32b48b8", + "name": "kony.ui.Label", + "parent": "loginContainer", + "pf": "frmLogin", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/loginContainer.json b/SegementAnimation/forms/mobile/frmLogin.sm/loginContainer.json new file mode 100644 index 0000000..1aa5cf2 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/loginContainer.json @@ -0,0 +1,65 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4f017ed309a499eb0c21235e28f53dd", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "imgLogo", + "lblTitle1", + "lblTitle2", + "fcUserId", + "fcUserPswd", + "fcSwitch", + "btnLogin", + "CheckBoxGroup0b0f5d1875e364d" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "loginContainer", + "info": null, + "isvisible": true, + "kuid": "a06a7699cc0f4ad4b672b2c827ce94f5", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmLogin", + "percent": true, + "pf": "frmLogin", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/txtBoxUserId.json b/SegementAnimation/forms/mobile/frmLogin.sm/txtBoxUserId.json new file mode 100644 index 0000000..b9289ad --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/txtBoxUserId.json @@ -0,0 +1,64 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizTextBox2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "18%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_placeholder_": "user id", + "_render_": true, + "_skin_": "s796ebfbfb3347ab89809d8748b589ea", + "_text_": "", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "82%" + }, + "autocapitalize": "none", + "autocomplete": false, + "autocorrect": false, + "autofilter": false, + "canUpdateUI": true, + "containerheight": "", + "containerheightmode": 1, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "focusskin": "s796ebfbfb3347ab89809d8748b589ea", + "id": "txtBoxUserId", + "info": null, + "isvisible": true, + "keyboardtype": "A", + "kuid": "54df1975cd4e4adbbadc4efbf9ef0f74", + "mode": "A", + "name": "kony.ui.TextBox2", + "parent": "fcUserId", + "pf": "frmLogin", + "securetextentry": false, + "textinputmode": "A", + "tooltip": "", + "viewtype": "default", + "wType": "TextField", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmLogin.sm/txtBoxUserPswd.json b/SegementAnimation/forms/mobile/frmLogin.sm/txtBoxUserPswd.json new file mode 100644 index 0000000..5204c12 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmLogin.sm/txtBoxUserPswd.json @@ -0,0 +1,65 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizTextBox2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "18%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_placeholder_": "password", + "_render_": true, + "_skin_": "s796ebfbfb3347ab89809d8748b589ea", + "_text_": "", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "82%" + }, + "autocapitalize": "none", + "autocomplete": false, + "autocorrect": false, + "autofilter": false, + "canUpdateUI": true, + "containerheight": "", + "containerheightmode": 1, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "focusskin": "s796ebfbfb3347ab89809d8748b589ea", + "id": "txtBoxUserPswd", + "info": null, + "initText": "TextBox2", + "isvisible": true, + "keyboardtype": "A", + "kuid": "69b31cfc13cb40d7acf7ea06b4896450", + "mode": "A", + "name": "kony.ui.TextBox2", + "parent": "fcUserPswd", + "pf": "frmLogin", + "securetextentry": true, + "textinputmode": "A", + "tooltip": "", + "viewtype": "default", + "wType": "TextField", + "widgetalignment": 5, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmMap.sm/Map045d7344df01044.json b/SegementAnimation/forms/mobile/frmMap.sm/Map045d7344df01044.json new file mode 100644 index 0000000..83de328 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmMap.sm/Map045d7344df01044.json @@ -0,0 +1,74 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizMap", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "0dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_mode_": 1, + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "calloutwidth": 80, + "canUpdateUI": true, + "containerweight": 100, + "defaultpinimage": "pinb.png", + "id": "Map045d7344df01044", + "info": null, + "isvisible": true, + "kuid": "3381f0fe381a4854bfb083f627928c29", + "locationdata": [ + { + "desc": "Phoenix infocity, Gachibowli", + "lat": "17.447326", + "lon": "78.371358", + "name": "KonyLabs(New)" + }, + { + "desc": "Mindspace, Hitech City", + "lat": "17.441839", + "lon": "78.380928", + "name": "KonyLabs(Old)" + }, + { + "desc": "Orlando, US", + "lat": "28.449340", + "lon": "-81.481519", + "name": "KonyLabs" + } + ], + "mapsource": "non-native", + "mapsrc": "non-native", + "name": "kony.ui.Map", + "parent": "frmMap", + "pf": "frmMap", + "provider": "google", + "screenlevelwidget": false, + "wType": "Map", + "widgetalignment": 5, + "zoomlevel": 15 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmMap.sm/frmMap.json b/SegementAnimation/forms/mobile/frmMap.sm/frmMap.json new file mode 100644 index 0000000..b0517e7 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmMap.sm/frmMap.json @@ -0,0 +1,107 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s3f768fd25ab44b297054cc4d6ed59a4", + "_title_": "Map", + "addWidgetsdone": false, + "allboxes": [], + "android": { + "needAppMenu": false + }, + "canUpdateUI": true, + "children": [ + "Map045d7344df01044" + ], + "containerweight": 100, + "contentoffsetx": 0, + "contentoffsety": 0, + "contentsizeheight": 0, + "contentsizewidth": 0, + "currentLocale": null, + "desktopweb": { + "needAppMenu": false + }, + "device": "iPhone6", + "displayorientation": 1, + "enabled": false, + "enabledforidletimeout": false, + "id": "frmMap", + "info": null, + "initdone": false, + "inputaccessoryviewtype": 4, + "ipad": { + "psp": { + "inputAccessoryViewType": 4 + } + }, + "iphone": { + "needAppMenu": false, + "psp": { + "inputAccessoryViewType": 4, + "titleBarConfig": { + "buttonClosureLeftSideView": "", + "buttonClosureRightSideView": "", + "buttonText": "Edit", + "leftButtonText": "Back", + "leftTitle": "Back", + "prevFormTitle": false, + "renderTitleText": true, + "rightTitle": "Edit", + "titleBarLeftSideView": "button", + "titleBarRightSideView": "none", + "titleClosureLeftSideView": "", + "titleClosureRightSideView": "", + "visible": true + } + }, + "titleBar": true + }, + "isvisible": true, + "kuid": "ece0c08f07a047179fedee1c2c900474", + "layouttype": 2, + "name": "kony.ui.Form2", + "needappmenu": true, + "orientation": 1, + "paddinginpixel": false, + "percent": true, + "platform": "iphone", + "prevDevice": "iPhone6", + "prevPlatform": "iphone", + "retainscrollposition": false, + "shellCSS": "iOS_iPhone6", + "snapgridsize": 10, + "snaptogrid": true, + "spaan": { + "needAppMenu": false + }, + "spabb": { + "needAppMenu": false + }, + "spaip": { + "needAppMenu": false + }, + "spawinphone8": { + "needAppMenu": false + }, + "titleBarSkin": "sf4e9c0e12b141698a1823eef22b7e95", + "titlebar": true, + "type": 3, + "wType": "Form", + "widgetalignment": 5, + "winphone8": { + "needAppMenu": false + } +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmtest.sm/btnBack.json b/SegementAnimation/forms/mobile/frmtest.sm/btnBack.json new file mode 100644 index 0000000..dcd04b5 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmtest.sm/btnBack.json @@ -0,0 +1,54 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "40%" + }, + "_left_": { + "type": "string", + "value": "7dp" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd2728eeba0d4770a5cdfd653687dc21", + "_text_": "", + "_top_": { + "type": "string", + "value": "32%" + }, + "_width_": { + "type": "string", + "value": "70dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s4e0322e4f174715887416830e0a11a1", + "id": "btnBack", + "ide_onClick": "AS_Button_eca2998968164527addd369d01ff55af", + "info": null, + "isvisible": true, + "kuid": "1ff6bad31b1943abaa411cb19ef647cf", + "name": "kony.ui.Button", + "onclick": "AS_Button_eca2998968164527addd369d01ff55af", + "parent": "fcTitle", + "pf": "frmtest", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmtest.sm/btnLogout.json b/SegementAnimation/forms/mobile/frmtest.sm/btnLogout.json new file mode 100644 index 0000000..1f85d49 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmtest.sm/btnLogout.json @@ -0,0 +1,52 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizButton", + "DNDConfig": null, + "__parentReadjusting__": false, + "_enabled_": false, + "_height_": { + "type": "string", + "value": "40%" + }, + "_margin_": [ + 6, + 6, + 6, + 6 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "7dp" + }, + "_skin_": "s7fcaddf95a142beb8775f2a55566133", + "_text_": "", + "_top_": { + "type": "string", + "value": "32%" + }, + "_width_": { + "type": "string", + "value": "70dp" + }, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "displaytext": true, + "focusskin": "s4e0322e4f174715887416830e0a11a1", + "id": "btnLogout", + "info": null, + "isvisible": false, + "kuid": "d5dda511b7c44d25bd2fa5d1ef2bd590", + "name": "kony.ui.Button", + "parent": "fcTitle", + "pf": "frmtest", + "wType": "Button", + "widgetalignment": 5, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmtest.sm/fcFrmContainer.json b/SegementAnimation/forms/mobile/frmtest.sm/fcFrmContainer.json new file mode 100644 index 0000000..84f4e7c --- /dev/null +++ b/SegementAnimation/forms/mobile/frmtest.sm/fcFrmContainer.json @@ -0,0 +1,59 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "91%" + }, + "_left_": { + "type": "string", + "value": "0dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s9bf40c1918e452ba896b3f9fc73bef9", + "_top_": { + "type": "string", + "value": "9%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "segFavRestaurents" + ], + "clipbounds": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcFrmContainer", + "info": null, + "isvisible": true, + "kuid": "9a1dd5d7503742e1bb86699ce735c665", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmtest", + "percent": true, + "pf": "frmtest", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmtest.sm/fcTitle.json b/SegementAnimation/forms/mobile/frmtest.sm/fcTitle.json new file mode 100644 index 0000000..1524361 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmtest.sm/fcTitle.json @@ -0,0 +1,61 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "9%" + }, + "_left_": { + "type": "string", + "value": "0px" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s9ec461af5054f12aacda4e3128c37b7", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "lblTitle", + "btnBack", + "btnLogout" + ], + "clipbounds": false, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcTitle", + "info": null, + "isvisible": true, + "kuid": "1fdf3444f47d48ccb721f80eb6995c15", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "frmtest", + "percent": true, + "pf": "frmtest", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmtest.sm/frmtest.json b/SegementAnimation/forms/mobile/frmtest.sm/frmtest.json new file mode 100644 index 0000000..2bd17c7 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmtest.sm/frmtest.json @@ -0,0 +1,108 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s4c239ca064c41f29fafc526d710bcd6", + "_title_": null, + "addWidgetsdone": false, + "allboxes": [], + "android": { + "needAppMenu": false + }, + "canUpdateUI": true, + "children": [ + "fcTitle", + "fcFrmContainer" + ], + "containerweight": 100, + "contentoffsetx": 0, + "contentoffsety": 0, + "contentsizeheight": 0, + "contentsizewidth": 0, + "currentLocale": null, + "desktopweb": { + "needAppMenu": false + }, + "device": "iPhone6", + "displayorientation": 1, + "enabled": false, + "enabledforidletimeout": false, + "id": "frmtest", + "info": null, + "initdone": false, + "inputaccessoryviewtype": 4, + "ipad": { + "psp": { + "inputAccessoryViewType": 4 + } + }, + "iphone": { + "needAppMenu": false, + "psp": { + "inputAccessoryViewType": 4, + "titleBarConfig": { + "buttonClosureLeftSideView": "", + "buttonClosureRightSideView": "", + "buttonText": "Edit", + "leftButtonText": "Back", + "leftTitle": "Back", + "prevFormTitle": false, + "renderTitleText": true, + "rightTitle": "Edit", + "titleBarLeftSideView": "button", + "titleBarRightSideView": "button", + "titleClosureLeftSideView": "", + "titleClosureRightSideView": "", + "visible": false + } + }, + "titleBar": false + }, + "isvisible": true, + "kuid": "e2c7f25ece8843aeabbfef0f32530566", + "layouttype": 2, + "name": "kony.ui.Form2", + "needappmenu": true, + "orientation": 1, + "paddinginpixel": false, + "percent": true, + "platform": "iphone", + "prevDevice": "iPhone6", + "prevPlatform": "iphone", + "retainscrollposition": false, + "shellCSS": "iOS_iPhone6", + "snapgridsize": 10, + "snaptogrid": true, + "spaan": { + "needAppMenu": false + }, + "spabb": { + "needAppMenu": false + }, + "spaip": { + "needAppMenu": false + }, + "spawinphone8": { + "needAppMenu": false + }, + "titleBarSkin": "sa1f21944341431ebbcaa9421c715af9", + "titlebar": true, + "type": 3, + "wType": "Form", + "widgetalignment": 5, + "winphone8": { + "needAppMenu": false + } +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmtest.sm/lblTitle.json b/SegementAnimation/forms/mobile/frmtest.sm/lblTitle.json new file mode 100644 index 0000000..8ce2097 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmtest.sm/lblTitle.json @@ -0,0 +1,61 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "100%" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s5c84e75663846cbb45ff536a4d1d473", + "_text_": "Favorites", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "_wrapping_": 2, + "canUpdateUI": true, + "containerweight": 100, + "contentalignment": 5, + "enabled": false, + "id": "lblTitle", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + } + }, + "isvisible": true, + "kuid": "3fbcbfaca87342638c3945713ae3d719", + "name": "kony.ui.Label", + "parent": "fcTitle", + "pf": "frmtest", + "tooltip": "", + "wType": "Label", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/forms/mobile/frmtest.sm/segFavRestaurents.json b/SegementAnimation/forms/mobile/frmtest.sm/segFavRestaurents.json new file mode 100644 index 0000000..2e44a88 --- /dev/null +++ b/SegementAnimation/forms/mobile/frmtest.sm/segFavRestaurents.json @@ -0,0 +1,161 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizSegment2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_data_": [ + { + "imgDelete": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "delete.png" + }, + "imgMore": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "more.png" + }, + "imgResIcon": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "img1.png" + }, + "lblLine": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "" + }, + "lblResInfo": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Label" + }, + "lblResName": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Label" + } + }, + { + "imgDelete": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "delete.png" + }, + "imgMore": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "more.png" + }, + "imgResIcon": { + "@class": "com.viz.ide.model.segment.ImageSegmentData", + "src": "img2.png" + }, + "lblLine": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "" + }, + "lblResInfo": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Label" + }, + "lblResName": { + "@class": "com.viz.ide.model.segment.SimpleTextSegmentData", + "text": "Label" + } + } + ], + "_enabled_": false, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_indicator_": "none", + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_orientation_": 2, + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_rowtemplateid": "favTemplate", + "_top_": { + "type": "string", + "value": "0%" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "autogrowmode": 1, + "canUpdateUI": true, + "containerweight": 100, + "counter": "01", + "focusedindex": null, + "focuseditem": null, + "generatedtemplate": "562cf20ae57c4758a9c61d38996d698b", + "groupcells": false, + "hasSections": false, + "id": "segFavRestaurents", + "info": null, + "ipad": { + "psp": { + "indicator": "rowselect" + } + }, + "iphone": { + "psp": { + "indicator": "rowselect" + } + }, + "isvisible": true, + "kuid": "dab053c87bf1440a8870cd3418a62bbd", + "masterdata": {}, + "name": "kony.ui.SegmentedUI2", + "needpageindicator": true, + "pageoffdotimage": "pageOffDot.png", + "pageondotimage": "pageOnDot.png", + "paginationconfig": { + "position": "bottom" + }, + "parent": "fcFrmContainer", + "pf": "frmtest", + "retainselection": false, + "rowTemplateId": "a29bcabb4c6c4bb5b6f38a24217a57f4", + "rowcounter": 1, + "rowfocusskin": "sf73da56dc46443ab1168dd77d3a92c3", + "rowskin": "s1cf81e2c5814641983ca7e23b3eaf61", + "rowtemplate": "FlexContainerFavorite", + "screenlevelwidget": false, + "seccounter": 0, + "sectionHeaderTemplateId": null, + "sectionheaderskin": "s5dcf5786ff140d0a6444670d4071291", + "selectedRows": null, + "selectedState": false, + "selectedindex": null, + "selectedindices": null, + "selecteditems": null, + "selectedsectionindex": 0, + "selectionbehavior": "default", + "separatorcolor": "3c610500", + "separatorrequired": false, + "separatorthickness": 20, + "showscrollbars": false, + "viewtype": "tableview", + "wType": "Segment", + "widgetalignment": 5, + "widgetdatamap": { + "FlexContainerDeleteBtn": "FlexContainerDeleteBtn", + "FlexContainerFavorite": "FlexContainerFavorite", + "FlexContainerMoreBtn": "FlexContainerMoreBtn", + "fcResDetails": "fcResDetails", + "imgDelete": "imgDelete", + "imgMore": "imgMore", + "imgResIcon": "imgResIcon", + "lblLine": "lblLine", + "lblResInfo": "lblResInfo", + "lblResName": "lblResName" + } +} \ No newline at end of file diff --git a/SegementAnimation/global.properties b/SegementAnimation/global.properties new file mode 100644 index 0000000..e1a07fc --- /dev/null +++ b/SegementAnimation/global.properties @@ -0,0 +1,22 @@ +#This file need to be copied in workspace location +#Note: Please escape '\' with '\\' in file paths (Ex: C:\\workspace\\project) + +#Envirnoment details +workspace.location= + +#Full Path to a jar file whose name starts with 'org.eclipse.equinox.launcher_' in eclipse plugins folder +#Example: D:\\eclipse\\plugins\\org.eclipse.equinox.launcher_1.1.0.v20100507.jar +eclipse.equinox.path= + +#preference details +imagemagic.home= +android.home= +run.luaapichecker=false +playbook.home= +qt.home= +palm.home= +bb10.ndk.home= +bb10.signing.keys.home = +bb10.emulator.ip= +bb10.emulator.password= +bb10.vmware.home= \ No newline at end of file diff --git a/SegementAnimation/konyplugins.xml b/SegementAnimation/konyplugins.xml new file mode 100644 index 0000000..328a0f2 --- /dev/null +++ b/SegementAnimation/konyplugins.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SegementAnimation/lua_widget_m4_info.properties b/SegementAnimation/lua_widget_m4_info.properties new file mode 100644 index 0000000..6af8657 --- /dev/null +++ b/SegementAnimation/lua_widget_m4_info.properties @@ -0,0 +1,97 @@ +#This file contains the lua m4Constants, the widgetQualifying ids and the type of the widget +#Thu Oct 29 13:24:36 IST 2015 +~|~frmHome.lblTitle=label +~|~fcResDetailfcResDetail.imgResIcon=image +~|~frmDetails.lblRating=label +~|~frmFavorite.segFavRestaurents=segui +~|~frmLogin.btnLogin=button +~|~frmDetails.btnLogout=button +~|~frmHome.Button0243bef6030b74d=button +~|~frmFavorite.lblTitle=label +~|~frmLogin.fcSwitch=flexcontainer +~|~frmDetails.imgRestaurent=image +~|~frmtest.btnBack=button +~|~frmtest.lblTitle=label +~|~frmtest=form2 +~|~frmLogin.lblSeparator=label +~|~frmDetails.lblResAdd=label +~|~frmHome.FlexContainer0ccecc465000a43=flexcontainer +~|~frmDetails.lblCusines=label +~|~frmtest.segFavRestaurents=segui +~|~frmDetails.fcResDetailsContainer=flexcontainer +~|~frmDetails.lblCuisinesDetails=label +~|~frmDetails.fcFrmDetailsContainer=flexcontainer +~|~frmHome.btnLogout=button +~|~FlexContainerFavorite.FlexContainerDeleteBtn=flexcontainer +~|~frmDetails.fcTitle=flexcontainer +~|~frmLogin.CheckBoxGroup0b0f5d1875e364d=checkboxgroup +~|~frmDetails.fcBtnrate=flexcontainer +~|~frmDetails.CopylblCuisinesDetails0b742884ef22f43=label +~|~frmDetails.CopyLabel06c60a4883e2f45=label +~|~frmLogin.fcUserId=flexcontainer +~|~frmDetails.btnFavorite=button +~|~fcResDetailfcResDetail.lblResName=label +~|~frmLogin=form2 +~|~/SegementAnimation/templates/mobile/segments/CopyFBox071e8af1ebb8340=segui +~|~FlexContainerFavorite.lblLine=label +~|~FlexContainerFavorite=flexcontainer +~|~frmLogin.Switch03dcb15500a7f43=switch +~|~Form00a240e66adfc4e.Button0ce1d574251ee4e=button +~|~FlexContainerFavorite.lblResInfo=label +~|~Form00a240e66adfc4e=form2 +~|~frmDetails.fcCost=flexcontainer +~|~frmDetails.btnRate=button +~|~frmDetails.lblResName=label +~|~frmFavorite.btnBack=button +~|~/SegementAnimation/templates/mobile/segments/favTemplate=segui +~|~FlexContainerFavorite.imgDelete=image +~|~frmDetails.CopylblCusines0e87c021cdaac4c=label +~|~FlexContainerFavorite.imgResIcon=image +~|~frmLogin.txtBoxUserId=textfield +~|~frmLogin.lblSwitch=label +~|~frmHome.Button077b6130fce3d46=button +~|~fcResDetailfcResDetail=flexcontainer +~|~frmtest.btnLogout=button +~|~frmDetails=form2 +~|~frmtest.fcFrmContainer=flexcontainer +~|~fcResDetailfcResDetail.lblLine=label +~|~FlexContainerFavorite.FlexContainerMoreBtn=flexcontainer +~|~frmtest.fcTitle=flexcontainer +~|~frmFavorite.fcFrmContainer=flexcontainer +~|~frmDetails.Label07788dc95418f42=label +~|~frmMap.Map045d7344df01044=map +~|~frmHome=form2 +~|~frmLogin.loginContainer=flexcontainer +~|~frmLogin.CopylblSeparator0ba52bbe93a644a=label +~|~/SegementAnimation/templates/mobile/segments/FBox064a1b8498c1348=segui +~|~frmDetails.btnMap=button +~|~frmDetails.fcResDetails=flexcontainer +~|~frmDetails.btnBack=button +~|~FlexContainerFavorite.imgMore=image +~|~frmDetails.lblTitle=label +~|~frmDetails.fcBtnFavorite=flexcontainer +~|~frmDetails.CopylblCusines0386b0e110fbf40=label +~|~frmHome.segmentRestaurentList=segui +~|~frmDetails.fcAddress=flexcontainer +~|~FlexContainerFavorite.fcResDetails=flexcontainer +~|~frmHome.btnFavorites=button +~|~frmLogin.lblTitle2=label +~|~frmLogin.lblTitle1=label +~|~frmDetails.fcCuisins=flexcontainer +~|~FlexContainerFavorite.lblResName=label +~|~fcResDetailfcResDetail.lblResInfo=label +~|~frmLogin.imgicon1=image +~|~frmHome.fcTitle=flexcontainer +~|~frmMap=form2 +~|~frmDetails.CopyLabel0322dbd3661fd43=label +~|~frmDetails.FlexContainer01dc4e76c44b04f=flexcontainer +~|~frmLogin.imgLogo=image +~|~frmLogin.txtBoxUserPswd=textfield +~|~/SegementAnimation/templates/mobile/segments/CopyFBox0431dcec4fd8f45=segui +~|~frmLogin.imgIcon=image +~|~frmLogin.fcUserPswd=flexcontainer +~|~frmDetails.lblAddress=label +~|~frmFavorite.btnLogout=button +~|~frmFavorite.fcTitle=flexcontainer +~|~frmFavorite=form2 +~|~/SegementAnimation/templates/mobile/segments/resTemplate=segui diff --git a/SegementAnimation/middleware.properties b/SegementAnimation/middleware.properties new file mode 100644 index 0000000..c43525c --- /dev/null +++ b/SegementAnimation/middleware.properties @@ -0,0 +1,5 @@ +#Tue Nov 24 15:15:37 IST 2015 +httpport=80 +httpsport=443 +middlewarecontext=middleware +ipaddress=192.168.56.1 diff --git a/SegementAnimation/modules/KonySyncLib.js b/SegementAnimation/modules/KonySyncLib.js new file mode 100644 index 0000000..1bd3162 --- /dev/null +++ b/SegementAnimation/modules/KonySyncLib.js @@ -0,0 +1,13929 @@ +// KonySyncLib.js +// --Generated On Mon Nov 09 17:45:50 IST 2015******************* +// +// +// **************** Start jsonWriter.js******************* +//#ifdef iphone + //#define KONYSYNC_IOS +//#endif +//#ifdef bb + //#define KONYSYNC_BB +//#endif +//#ifdef bb10 + //#define KONYSYNC_BB10 +//#endif +//#ifdef winmobile + //#define KONYSYNC_WINDOWS +//#endif +//#ifdef winmobile6x + //#define KONYSYNC_WINDOWS +//#endif +//#ifdef winphone8 + //#define KONYSYNC_WINDOWS +//#endif +//#ifdef android + //#define KONYSYNC_ANDROID +//#endif +//#ifdef j2me + //#define KONYSYNC_J2ME +//#endif + +//#ifdef ipad + //#define KONYSYNC_IOS +//#endif +//#ifdef tabrcandroid + //#define KONYSYNC_ANDROID +//#endif +//#ifdef playbook + //#define KONYSYNC_WINDOWS +//#endif +//#ifdef spaipad + //#define KONYSYNC_IOS +//#endif +//#ifdef spatabandroid + //#define KONYSYNC_ANDROID +//#endif +//#ifdef spaplaybook + //#define KONYSYNC_WINDOWS +//#endif +//#ifdef windows8 + //#define KONYSYNC_WINDOWS +//#endif +//#ifdef spatabwindows + //#define KONYSYNC_WINDOWS +//#endif + +//#ifdef desktop_kiosk + //#define KONYSYNC_WINDOWS +//#endif +//#ifdef desktopweb + //#define KONYSYNC_WINDOWS +//#endif + + +//#ifdef iphone + //#define KONYSYNC_MOBILE +//#endif +//#ifdef bb + //#define KONYSYNC_MOBILE +//#endif +//#ifdef bb10 + //#define KONYSYNC_MOBILE +//#endif +//#ifdef winmobile + //#define KONYSYNC_MOBILE +//#endif +//#ifdef winmobile6x + //#define KONYSYNC_MOBILE +//#endif +//#ifdef winphone8 + //#define KONYSYNC_MOBILE +//#endif +//#ifdef android + //#define KONYSYNC_MOBILE +//#endif +//#ifdef j2me + //#define KONYSYNC_MOBILE +//#endif +//#ifdef symbian + //#define KONYSYNC_MOBILE +//#endif + +//#ifdef ipad + //#define KONYSYNC_TAB +//#endif +//#ifdef tabrcandroid + //#define KONYSYNC_TAB +//#endif +//#ifdef playbook + //#define KONYSYNC_TAB +//#endif +//#ifdef spaipad + //#define KONYSYNC_TAB +//#endif +//#ifdef spatabandroid + //#define KONYSYNC_TAB +//#endif +//#ifdef spaplaybook + //#define KONYSYNC_TAB +//#endif +//#ifdef windows8 + //#define KONYSYNC_TAB +//#endif +//#ifdef spatabwindows + //#define KONYSYNC_TAB +//#endif + +//#ifdef desktop_kiosk + //#define KONYSYNC_DESKTOP +//#endif +//#ifdef desktopweb + //#define KONYSYNC_DESKTOP +//#endif + +//#ifdef KONYSYNC_IOS + //#define KONYSYNC_ENCRYPTION_AVAILABLE +//#endif +//#ifdef KONYSYNC_ANDROID + //#define KONYSYNC_ENCRYPTION_AVAILABLE +//#endif +//#ifdef KONYSYNC_WINDOWS + //#define KONYSYNC_ENCRYPTION_AVAILABLE +//#endif + +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} +/* +kony.sync.jsonGetType = function(node) { + sync.log.trace("Entering kony.sync.jsonGetType "); + if (kony.type(node) === "table") { + for (var key in node) { + if ((key === 1)) { + return 1; + } else if (key === "1") { + return 1; + } else { + return 2; + } + } + return 1; + } + return 0; +}; + +kony.sync.createJson = function(key, data) { + sync.log.trace("Entering kony.sync.createJson "); + kony.sync.jsonBegin(); + kony.sync.jsonWriteKeyValue(key, data); + kony.sync.jsonEnd(); + return js; +}; + +kony.sync.jsonWriteKeyValue = function(key, data) { + sync.log.trace("Entering kony.sync.jsonWriteKeyValue "); + kony.sync.jsonBeginElement(key); + kony.sync.jsonWriteValue(data); +}; + +kony.sync.jsonWriteValue = function(data) { + sync.log.trace("Entering kony.sync.jsonWriteValue "); + datatype = kony.sync.jsonGetType(data); + var len = null; + if (datatype === 0) { + kony.sync.jsonString(data); + } else if (datatype === 1) { + kony.sync.jsonBeginArray(); + len = kony.sync.jsonwriter_ipairs_length(data); + var count1 = 0; + if(!kony.sync.isNullOrUndefined(data)){ + for (var i = 0; i < data.length; i++) { + var v = data[i]; + count1 = count1 + 1; + kony.sync.jsonWriteValue(v); + if ((count1 !== len)) { + js = js + ","; + } + } + } + kony.sync.jsonEndArray(); + } else { + kony.sync.jsonBeginHash(); + len = kony.sync.jsonwriter_pairs_length(data); + var count2 = 0; + for (var key in data) { + var value = data[key]; + count2 = count2 + 1; + kony.sync.jsonWriteKeyValue(key, value); + if ((count2 !== len)) { + js = js + ","; + } + } + kony.sync.jsonEndHash(); + } +}; + +kony.sync.jsonBegin = function() { + sync.log.trace("Entering kony.sync.jsonBegin "); + js = "{"; +}; + +kony.sync.jsonEnd = function() { + sync.log.trace("Entering kony.sync.jsonEnd "); + js = js + " }"; +}; + +kony.sync.jsonBeginElement = function(elementName) { + sync.log.trace("Entering kony.sync.jsonBeginElement "); + js = js + "\"" + elementName + "\"" + " : "; +}; + +kony.sync.jsonBeginArray = function() { + sync.log.trace("Entering kony.sync.jsonBeginArray "); + js = js + " \["; +}; + +kony.sync.jsonEndArray = function() { + sync.log.trace("Entering kony.sync.jsonEndArray "); + js = js + " \]"; +}; + +kony.sync.jsonBeginHash = function() { + sync.log.trace("Entering kony.sync.jsonBeginHash "); + js = js + " \{"; +}; + +kony.sync.jsonEndHash = function() { + sync.log.trace("Entering kony.sync.jsonEndHash "); + js = js + " \}"; +}; + +kony.sync.jsonAddValue = function(key, value) { + sync.log.trace("Entering kony.sync.jsonAddValue "); + js = js + " \"" + key + "\" : " + "\"" + value + "\""; +}; + +kony.sync.jsonString = function(value) { + sync.log.trace("Entering kony.sync.jsonString "); + if ((value === "null")) { + js = js + "null"; + } else { + js = js + "\"" + value + "\""; + } +}; + +kony.sync.jsonwriter_pairs_length = function(tab) { + sync.log.trace("Entering kony.sync.jsonwriter_pairs_length "); + var count = 0; + if (!kony.sync.isNullOrUndefined(tab)) { + for (var key in tab) { + count = count + 1; + } + } + return count; +}; + +kony.sync.jsonwriter_ipairs_length = function(tab) { + sync.log.trace("Entering kony.sync.jsonwriter_ipairs_length "); + var count = 0; + if(!kony.sync.isNullOrUndefined(tab)){ + for (var key = 0; key < tab.length; key++) { + count = count + 1; + } + } + return count; +}; +*/ +// **************** End jsonWriter.js******************* + + +// **************** Start KonySyncAPI.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} + +if(typeof(sync)=== "undefined"){ + sync = {}; +} + +// Device Auto Registration and Validation Starts here -- +sync.startSession = function(config) { + if(kony.sync.validateSyncConfigParams("startSession", config) === false){ + return; + } + if(kony.sync.preProcessSyncConfig("startSession", config, config[kony.sync.onSyncError]) === false){ + return; + } + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncStart], kony.sync.currentSyncReturnParams); + var registerSuccess = true; + var alreadyRegistered = false; + var isError = false; + function single_transaction_callback(tx) { + sync.log.trace("Entering single_transaction_callback"); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, [kony.sync.syncConfigurationColumnDeviceIDName]); + kony.sync.qb_from(query, kony.sync.syncConfigurationTableName); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params,kony.sync.currentSyncConfigParams[kony.sync.onSyncError]); + if(resultSet === false){ + registerSuccess = false; + isError = true; + return; + } + if(resultSet.rows.length === 0){ + isError = true; + return; + } + var record = kony.db.sqlResultsetRowItem(tx, resultSet, 0); + sync.log.debug("Device Record: ", record); + sync.log.debug("Device ID: ", record.DeviceID); + if (record.DeviceID !== kony.sync.getDeviceID()) { + kony.sync.konyRegisterDevice(registerDeviceCallback); + sync.log.info("Registering Device..."); + } + else { + alreadyRegistered = true; + sync.log.info("Device already registered"); + } + } + + function registerDeviceCallback(serverResponse) { + sync.log.trace("Entering registerDeviceCallback"); + if (!kony.sync.isNullOrUndefined(serverResponse.opstatus) && serverResponse.opstatus !== 0) { + if (!kony.sync.isNullOrUndefined(serverResponse.d)) { + sync.log.error("Register Device Response : ", serverResponse); + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError], kony.sync.getServerError( + serverResponse.d)); + kony.sync.isSessionInProgress = false; + } else { + sync.log.error("Register Device Response : ", serverResponse); + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError], kony.sync.getServerError(serverResponse) ); + kony.sync.isSessionInProgress = false; + } + registerSuccess = false; + return; + } + else if(kony.sync.isNullOrUndefined(serverResponse.d)){ + registerSuccess = false; + kony.sync.isSessionInProgress = false; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError], kony.sync.getServerError(serverResponse) ); + return; + } + if ((serverResponse.d.error === "true")) { + sync.log.error("Register Device Response : ", serverResponse); + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError], kony.sync.getServerError( + serverResponse.d)); + kony.sync.isSessionInProgress = false; + registerSuccess = false; + + return; + } + + sync.log.debug("Register Device Response : ", serverResponse); + var connection2 = kony.sync.getConnectionOnly(kony.sync.syncConfigurationDBName,kony.sync.syncConfigurationDBName, kony.sync.currentSyncConfigParams[kony.sync.onSyncError], "Load device id"); + if(connection2 !== null){ + kony.sync.startTransaction(connection2, single_device_register_callback, single_transaction_success_callback, single_transaction_error_callback, "Load device id"); + } + function single_device_register_callback(tx) { + sync.log.trace("Entering single_device_register_callback"); + kony.sync.instanceId = serverResponse.d.__registerdevice.instanceID; + var insertTab = {}; + + insertTab[kony.sync.syncConfigurationColumnInstanceIDName] = kony.sync.instanceId; + insertTab[kony.sync.syncConfigurationColumnDeviceIDName] = kony.sync.getDeviceID(); + + var wcs = {}; + kony.table.insert(wcs, {key: kony.sync.syncConfigurationColumnDeviceIDName, value: ""}); + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, kony.sync.syncConfigurationTableName); + kony.sync.qb_set(query, insertTab); + kony.sync.qb_where(query, wcs); + var query_compile = kony.sync.qb_compile(query); + + var sql = query_compile[0]; + var params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + return; + } + alreadyRegistered = true; + sync.log.info("Register Device success"); + } + } + + function single_transaction_error_callback(){ + sync.log.trace("Entering single_transaction_error_callback"); + sync.log.error("Register Device failed"); + //kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError], kony.sync.getSyncRegisterationFailed()); + kony.sync.isSessionInProgress = false; + kony.sync.callTransactionError(isError, kony.sync.currentSyncConfigParams[kony.sync.onSyncError]); + } + + function single_transaction_success_callback() { + sync.log.trace("Entering single_transaction_success_callback"); + if(registerSuccess && alreadyRegistered && !isError) { + //Check if schema upgrade is pending + if(kony.sync.schemaUpgradeNeeded){ + kony.sync.upgradeSchema(kony.sync.syncStartSession); + } + else{ + kony.sync.isDownloadPendingForSchemaUpgrade(isDownloadPendingForSchemaUpgradeCallback); + } + }else if(isError){ + sync.log.fatal("SynConfigTable is empty. There seems to be problem in sync.init"); + kony.sync.getErrorTable(kony.sync.errorCodeMetatableError, kony.sync.getErrorMessage(kony.sync.errorCodeMetatableError), null); + } + } + + function isDownloadPendingForSchemaUpgradeCallback(isError, errorObject, pending){ + if(isError){ + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError], errorObject); + }else{ + if(pending){ + kony.sync.omitUpload = true; //only download + kony.sync.schemaUpgradeDownloadPending = true; + } + kony.sync.syncStartSession(); + } + } + var connection = kony.sync.getConnectionOnly(kony.sync.syncConfigurationDBName,kony.sync.syncConfigurationDBName, kony.sync.currentSyncConfigParams[kony.sync.onSyncError], "Device Registration"); + if(connection !==null){ + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback, "Device Registration"); + } +}; + +kony.sync.syncStartSession = function(){ + sync.log.trace("Entering kony.sync.syncStartSession "); + sync.log.info("Calling syncStartSession..."); + kony.sync.isErrorInAnyScope = false; + kony.sync.syncErrorMessage = {}; + kony.sync.validateScopeSession(); +}; + +kony.sync.validateScopeSession = function(abortSync, syncErrorObject) { + sync.log.trace("Entering kony.sync.validateScopeSession "); + + //If sync is aborted not because of scope issues + if(abortSync === true){ + sync.log.trace("kony.sync.validateScopeSession->abortSync"); + kony.sync.isSessionInProgress = false; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError], syncErrorObject); + return; + } + + kony.sync.resetscopesessionglobals(callback); + function callback(isSyncComplete){ + var isError = false; + if (isSyncComplete === true) { + if(kony.sync.forceUpload === true){ + kony.sync.forceUpload = false; + kony.sync.omitDownload = false; + kony.sync.validateScopeSession(true, kony.sync.schemaUpgradeErrorObject); + return; + } + if(kony.sync.forceUploadUpgrade === true){ + kony.sync.forceUploadUpgrade = false; + kony.sync.omitDownload = false; + kony.sync.schemaUpgradeErrorObject(); + return; + } + if(!kony.sync.isErrorInAnyScope){ + if(!kony.sync.performOnlySchemaUpgrade){ + //Continue upgrade after upload + /* if(kony.sync.schemaUpgradeNeeded){ + kony.sync.upgradeSchema(kony.sync.syncStartSession); + return; + }*/ + + //start normal sync process after downloading changes for schema upgrade + if(kony.sync.schemaUpgradeDownloadPending){ + kony.sync.schemaUpgradeDownloadPending = false; + kony.sync.omitUpload = false; + kony.sync.omitDownload = false; + kony.sync.resetsyncsessionglobals(); + kony.sync.syncStartSession(); + return; + } + } + kony.sync.omitUpload = false; + kony.sync.omitDownload = false; + kony.sync.isSessionInProgress = false; + kony.sync.performOnlySchemaUpgrade = false; + sync.log.trace("kony.sync.validateScopeSession->calling onSyncSuccess function"); + kony.sync.schemaUpgradeDownloadPending = false; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncSuccess], kony.sync.currentSyncReturnParams); + } + else{ + sync.log.error("kony.sync.validateScopeSession->calling onSyncError function"); + kony.sync.isSessionInProgress = false; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError],kony.sync.getErrorTable(kony.sync.errorCodeSyncError,kony.sync.getErrorMessage(kony.sync.errorCodeSyncError),kony.sync.syncErrorMessage)); + } + return;// Sync Completes here. + } + + function validateTransaction(tx) { + sync.log.trace("Entering kony.sync.validateScopeSession->validateTransaction"); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, kony.sync.metaTableName); + kony.sync.qb_where(query, [{ + key: kony.sync.metaTableScopeColumn, + value: kony.sync.currentScope[kony.sync.scopeName] + }, { + key: kony.sync.metaTableFilterValue, + value: "no filter" + }]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet === false){ + isError = true; + return; + } + if (resultSet.rows.length !== 1) { + isError = true; + return; + } + if(kony.sync.schemaUpgradeDownloadPending){ + //check if download is pending after schema upgrade for this scope + var rowItem = kony.db.sqlResultsetRowItem(tx, resultSet, 0); + if(rowItem[kony.sync.metaTableSchemaUpgradeSyncTimeColumn]==="0,0"){ + kony.sync.omitDownload = false; //download for this scope + }else{ + kony.sync.omitDownload = true; //this scope has already been downloaded + } + } + kony.sync.currentSyncReturnParams.currentScope = kony.sync.currentScope[kony.sync.scopeName]; + } + + function startScopeSession() { + if(isError === true){ + errorScopeSession(); + return; + } + sync.log.trace("Entering kony.sync.validateScopeSession->startScopeSession"); + kony.sync.deleteMapKey(kony.sync.currentSyncReturnParams, kony.sync.serverDetails); + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onScopeStart], kony.sync.currentSyncReturnParams); + kony.sync.startUpload(); + } + + function errorScopeSession() { + sync.log.trace("Entering kony.sync.validateScopeSession->errorScopeSession"); + var isbreak = kony.sync.callTransactionError(isError, kony.sync.currentSyncConfigParams[kony.sync.onScopeError]); + if (isbreak === true) { + kony.sync.callTransactionError(isError, kony.sync.currentSyncConfigParams[kony.sync.onSyncError]); + kony.sync.isSessionInProgress = false; + return; + } + kony.sync.validateScopeSession(); + } + var connection = kony.sync.getConnectionOnly(kony.sync.currentScope[kony.sync.scopeDataSource], kony.sync.currentScope[kony.sync.scopeDataSource], errorScopeSession, "validate scope session"); + if(connection !== null){ + kony.sync.startTransaction(connection, validateTransaction, startScopeSession, errorScopeSession, "validate scope session"); + } + } +}; + +kony.sync.startUpload = function() { + sync.log.trace("Entering kony.sync.startUpload "); + if(kony.sync.omitUpload){ + kony.sync.uploadCompleted(); + return; + } + if (kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks])) { + kony.sync.syncUploadChanges(kony.sync.currentScope[kony.sync.scopeName], kony.sync.currentScope[kony.sync.scopeDataSource], kony.sync.uploadCompleted); + } else { + var scopename = kony.sync.currentScope[kony.sync.scopeName]; + if (kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][scopename] !== null && kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][scopename] !== undefined && kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][scopename][kony.sync.sessionTaskDoUpload]) { + kony.sync.syncUploadChanges(kony.sync.currentScope[kony.sync.scopeName], kony.sync.currentScope[kony.sync.scopeDataSource], kony.sync.uploadCompleted); + } else { + sync.log.info("Skipping Upload for Scope : ", kony.sync.currentScope[kony.sync.scopeName]); + kony.sync.uploadCompleted(); + } + } +}; + +kony.sync.uploadCompleted = function(error, msg) { + sync.log.trace("Entering kony.sync.uploadCompleted "); + if(error===true){ + sync.log.error("Error Occurred during upload : ",msg); + + //if schema change error occurred - app is not latest one + if(msg.errorCode === kony.sync.servercodes.appVersionNotLatest){ + kony.sync.onSchemaUpgradeErrorFromServer(msg); + return; + } + + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onScopeError], msg); + kony.sync.isErrorInAnyScope = true; + kony.sync.syncErrorMessage[kony.sync.currentScope[kony.sync.scopeName]] = msg; + kony.sync.validateScopeSession(); + }else{ + if(kony.sync.omitDownload){ //In case download is force disabled + kony.sync.validateScopeSession(); + return; + } + if(kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks]) || kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][kony.sync.currentScope[kony.sync.scopeName]])) { + kony.sync.syncDownloadChanges(kony.sync.currentScope[kony.sync.scopeName], kony.sync.currentScope[kony.sync.scopeDataSource], kony.sync.downloadCompletedCallback); + } else { + if (kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][kony.sync.currentScope[kony.sync.scopeName]][kony.sync.sessionTaskDoDownload]) { + kony.sync.syncDownloadChanges(kony.sync.currentScope[kony.sync.scopeName], kony.sync.currentScope[kony.sync.scopeDataSource], kony.sync.downloadCompletedCallback); + } else { + sync.log.info("Skipping Download for Scope : ", kony.sync.currentScope[kony.sync.scopeName]); + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onScopeSuccess], kony.sync.currentSyncReturnParams); + //In case of OTA scope and dodownload is false, the records for corresponding ack's will be deleted + /*if (kony.sync.currentScope[kony.sync.syncStrategy] === kony.sync.syncStrategy_OTA){ + kony.sync.deleteRecordsAfterUpload(deleteRecordsAfterUploadCallback); + }*/ + if (kony.sync.isUploadErrorPolicyCOE(kony.sync.currentScope)) { + if(kony.sync.currentScope[kony.sync.syncStrategy] !== kony.sync.syncStrategy_OTA ) { + deleteRecordsAfterUploadCallback(0); + } else { + kony.sync.updateSyncOrderForScope(deleteRecordsAfterUploadCallback); + } + } + else{ + kony.sync.validateScopeSession(); + } + + } + } + } + + function deleteRecordsAfterUploadCallback(code){ + sync.log.trace("Entering deleteRecordsAfterUploadCallback"); + if(code!==0){ + kony.sync.isErrorInAnyScope = true; + var errObject = null; + + //statement error + if(code===kony.sync.errorCodeSQLStatement){ + errObject = kony.sync.errorObject; + } + //transaction error + else{ + errObject = kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null); + } + kony.sync.syncErrorMessage[kony.sync.currentScope[kony.sync.scopeName]] = errObject; + sync.log.error("Error occurred in Deleting Records After Upload : ", errObject); + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onScopeError], errObject); + } + kony.sync.validateScopeSession(); + } + +}; + +kony.sync.downloadCompletedCallback = function(error, msg) { + sync.log.trace("Entering kony.sync.downloadCompletedCallback "); + if(error){ + sync.log.error("Error occurred during download : ", msg); + + //if schema change error occurred - app is not latest one + if(msg.errorCode === kony.sync.servercodes.appVersionNotLatest){ + kony.sync.onSchemaUpgradeErrorFromServer(msg); + return; + } + + + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onScopeError], msg); + kony.sync.isErrorInAnyScope = true; + kony.sync.syncErrorMessage[kony.sync.currentScope[kony.sync.scopeName]] = msg; + } + else{ + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onScopeSuccess], kony.sync.currentSyncReturnParams); + } + kony.sync.validateScopeSession(); +}; + +kony.sync.validateSyncConfigParams = function(opName, config){ + if(kony.sync.isNullOrUndefined(config)){ + kony.sync.alert("Argument type mismatch found for operation:sync." + opName + ". Expected 'config object' Actual 'null or undefined'"); + return false; + } + if(typeof(config) !== "object"){ + kony.sync.alert("Argument type mismatch found for operation:sync." + opName + ". Expected 'config object' Actual '" + typeof(config) + "'"); + return false; + } + kony.sync.resetSessionVars(); +}; + +kony.sync.preProcessSyncConfig = function(opName, config, errorcallback, sessionRequired){ + if(!kony.sync.isSyncInitialized(errorcallback)){ + return false; + } + if(!kony.sync.scopenameExist(config,errorcallback)){ + return false; + } + kony.sync.syncConfigurationDBName = konysyncClientSyncConfig.AppID; + config.appVersion = kony.sync.configVersion;//konysyncClientSyncConfig.Version; + kony.sync.currentSyncConfigParams = config; + kony.sync.uploadClientContext = {}; + kony.sync.downloadClientContext = {}; + if(sessionRequired!==false){ + if (kony.sync.isSessionInProgress) { + sync.log.warn("Sync Session already in progress..."); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeSessionInProgress,kony.sync.getErrorMessage(kony.sync.errorCodeSessionInProgress),null)); + return false; + } + kony.sync.isSessionInProgress = true; + } + sync.log.debug("Starting sync." + opName + " with Current Config Params : ", config); + + kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey] = kony.sync.tonumber(kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]); + kony.sync.currentSyncConfigParams[kony.sync.maxParallelChunksKey] = kony.sync.tonumber(kony.sync.currentSyncConfigParams[kony.sync.maxParallelChunksKey]); + kony.sync.resetsyncsessionglobals(opName); +}; + +kony.sync.scopenameExist = function(config,errorcallback){ + sync.log.trace("Entering kony.sync.scopenameExist"); + if(!kony.sync.isNullOrUndefined(config[kony.sync.sessionTasks])){ + for(var key in config[kony.sync.sessionTasks]){ + if(kony.sync.isNullOrUndefined(kony.sync.scopeDict[key])){ + sync.log.error("Wrong scopename given in SessionTasks"); + kony.sync.alert("Wrong scopename given in SessionTasks"); + kony.sync.verifyAndCallClosure(errorcallback, {}); + return false; + } + } + } + if(!kony.sync.isNullOrUndefined(config[kony.sync.removeAfterUpload])){ + for(var key in config[kony.sync.removeAfterUpload]){ + if(kony.sync.isNullOrUndefined(kony.sync.scopeDict[key])){ + sync.log.error("Wrong scopename given in RemoveAfterUpload"); + kony.sync.alert("Wrong scopename given in RemoveAfterUpload"); + kony.sync.verifyAndCallClosure(errorcallback, {}); + return false; + } + } + } + return true; +}; + +sync.stopSession = function(callback){ + sync.log.trace("Entering sync.stop"); + kony.sync.isSessionInProgress = false; + kony.sync.isSyncStopped = true; + kony.sync.onSyncStop = callback; +}; + +kony.sync.stopSyncSession = function(){ + kony.sync.isSyncStopped = false; + kony.sync.verifyAndCallClosure(kony.sync.onSyncStop); +}; +// **************** End KonySyncAPI.js******************* + + +// **************** Start KonySyncBlobConstants.js******************* +/** + * Created by KH9093 on 21-09-2015. + */ + +if (typeof(kony.sync) === "undefined") { + kony.sync = {}; +} +if (typeof(sync) === "undefined") { + sync = {}; +} + +if(typeof(kony.sync.blobManager) === "undefined") { + kony.sync.blobManager = {}; +}; + +kony.sync.BlobType = { + BASE64 : 1, + FILE: 2 +}; + + + +//defining states for blob manager. +kony.sync.blobManager.INSERT_PROCESSING = 1; +kony.sync.blobManager.INSERT_FAILED = 2; +kony.sync.blobManager.UPDATE_PROCESSING = 11; +kony.sync.blobManager.UPDATE_FAILED = 12; +kony.sync.blobManager.DELETE_PROCESSING = 21; +kony.sync.blobManager.DELETE_FAILED = 22; +kony.sync.blobManager.FILE_DOESNOT_EXIST = 31; +kony.sync.blobManager.DOWNLOAD_ACCEPTED= 61; +kony.sync.blobManager.DOWNLOAD_FAILED = 63; +kony.sync.blobManager.DOWNLOAD_IN_PROGRESS = 64; +kony.sync.blobManager.NO_OPERATION = 50; + +kony.sync.blobManager.ONDEMAND_FETCH_LIMIT = 1; +kony.sync.blobManager.ONDEMAND_FETCH_OFFSET = 0; + +//defining state messages.. + +kony.sync.blobManager.states = {}; + +kony.sync.blobManager.states[kony.sync.blobManager.INSERT_PROCESSING] = "Insert Operation in Process"; +kony.sync.blobManager.states[kony.sync.blobManager.INSERT_FAILED] = "Insert Operation Failed"; +kony.sync.blobManager.states[kony.sync.blobManager.UPDATE_PROCESSING] = "Update Operation in Process"; +kony.sync.blobManager.states[kony.sync.blobManager.UPDATE_FAILED] = "Update Operation Failed"; +kony.sync.blobManager.states[kony.sync.blobManager.DELETE_PROCESSING] = "Delete Operation in Process"; +kony.sync.blobManager.states[kony.sync.blobManager.DELETE_FAILED] = "Delete Operation Failed"; +kony.sync.blobManager.states[kony.sync.blobManager.FILE_DOESNOT_EXIST] = "Blob File doesn't exist."; +kony.sync.blobManager.states[kony.sync.blobManager.DOWNLOAD_ACCEPTED] = "Download request added to the queue"; +kony.sync.blobManager.states[kony.sync.blobManager.DOWNLOAD_FAILED] = "Download Operation Failed"; +kony.sync.blobManager.states[kony.sync.blobManager.DOWNLOAD_IN_PROGRESS] = "Download Operation in Process"; +kony.sync.blobManager.states[kony.sync.blobManager.NO_OPERATION] = "Blob record available"; +// **************** End KonySyncBlobConstants.js******************* + + +// **************** Start KonySyncBlobStoreManager.js******************* +// **************** Start BlobStoreManager.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} +if(typeof(kony.sync.blobManager) === "undefined") { + kony.sync.blobManager = {}; +} +/*columns of the BlobStoreManager table are --- + id, localPath, type, state, status, size, lastUpdatedTimeStamp + */ + + +kony.sync.blobManager.tableName = "tableName"; +kony.sync.blobManager.columnName = "columnName"; +kony.sync.blobManager.localPath = "localPath"; +kony.sync.blobManager.id = "id"; +kony.sync.blobManager.type = "type"; +kony.sync.blobManager.state = "state"; +kony.sync.blobManager.status = "status"; +kony.sync.blobManager.size = "size"; +kony.sync.blobManager.lastUpdatedTimeStamp = "lastUpdatedTimeStamp"; + + +var dbname = kony.sync.syncConfigurationDBName; +var tbname = "konysyncBLOBSTOREMANAGER"; +var resultset = null; + +/** + * Method used to update the blob store manager record for given blobid. + * @param tx - transaction id + * @param blobid - id of the blob store manager row. + * @param valuesTable - values that are updated in the record. + * @param errorCallback - error callback in case of failures. + * @returns {*} + */ +kony.sync.blobManager.updateBlobManager = function(tx, blobid, valuesTable, errorCallback){ + var query = kony.sync.qb_createQuery(); + + kony.sync.qb_set(query, valuesTable); + kony.sync.qb_where(query, [ + { + key : kony.sync.blobManager.id, + value : blobid + } + ]); + + kony.sync.qb_update(query, kony.sync.blobStoreManagerTable); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + resultset = kony.sync.executeSql(tx, sql, params, errorCallback); + + return resultset; +}; + +/** + * This method is used to insert a base64 in the konysyncBLOBSTOREMANAGER table. + * @param base64 the base64 value which has to be inserted in the blob store + */ + +kony.sync.blobManager.saveBlob = function(tx, tableName, columnName, base64, error_callback) { + + if(!kony.sync.isNullOrUndefined(base64) && base64.trim().length > 0) { + var query = kony.sync.qb_createQuery(); + + kony.sync.qb_set(query, { + localPath: "", + size: base64.length, + status: 100, + state: kony.sync.blobManager.INSERT_PROCESSING, + type: "base64", + tableName : tableName, + columnName : columnName, + lastUpdatedTimeStamp: 'now()' + }); + + kony.sync.qb_insert(query, kony.sync.blobStoreManagerTable); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + resultset = kony.sync.executeSql(tx, sql, params, error_callback); + + if (resultset === null || resultset === false) + return null; + + var blobId = resultset.insertId; + + var blobFileName = sync.util.savefile("" + blobId, base64); + kony.print("blob file is " + blobFileName); + //if file creation is successful.. insert the file path to the blobstoremanager. + var valuesTable = {}; + + if (blobFileName) { + //TODO - update the progress information. + valuesTable[kony.sync.blobManager.localPath] = blobFileName; + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.NO_OPERATION; + valuesTable[kony.sync.blobManager.status] = 100; + + kony.sync.blobManager.updateBlobManager(tx, blobId, valuesTable, error_callback); + + } else { + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.INSERT_FAILED; + valuesTable[kony.sync.blobManager.status] = 0; + kony.sync.blobManager.updateBlobManager(tx, blobId, valuesTable, error_callback); + + var error = kony.sync.getErrorTable( + kony.sync.errorCodeBlobFileNotCreated, + kony.sync.getErrorMessage(kony.sync.errorCodeBlobFileNotCreated) + ); + + error_callback(error); + return; + } + + return blobId; + } else { + var error = kony.sync.getErrorTable( + kony.sync.errorCodeEmptyOrNullBase64, + kony.sync.getErrorMessage(kony.sync.errorCodeEmptyOrNullBase64) + ); + + error_callback(error); + return; + } + +}; + +/** + * This method is used to delete records from the konysyncBLOBSTOREMANAGER table. + * @param id array which contains the list of valid ids whose records has to be deleted + * @return true if deletion is successful else false + */ + +kony.sync.blobManager.deleteBlob = function(tx, blobid, errorCallback) { + + kony.print("deleteBlobFromTable.."); + if (blobid === undefined || typeof(blobid) !== "number") { + //TODO - error object create. + var err = {}; + errorCallback(err); + return; + } else { + var blobMeta = kony.sync.blobManager.getBlobMetaDetails(tx, blobid, errorCallback); + //state, status, localPath + //delete the record only if it is in valid state. + var state = null; + if(!kony.sync.isNullOrUndefined(blobMeta)) { + state = blobMeta[kony.sync.blobManager.state]; + } + //TODO - can downloadAccepted be downloaded. + var possibleStates = [kony.sync.blobManager.INSERT_FAILED, kony.sync.blobManager.DELETE_FAILED, kony.sync.blobManager.FILE_DOESNOT_EXIST, + kony.sync.blobManager.NO_OPERATION,kony.sync.blobManager.UPDATE_FAILED ,kony.sync.blobManager.DOWNLOAD_FAILED]; + if(!kony.sync.isNullOrUndefined(state) && possibleStates.indexOf(state) !== -1) { + var valuesTable = {}; + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.DELETE_PROCESSING; + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorCallback); + + var deleteFile = sync.util.deletefile(blobMeta[kony.sync.blobManager.localPath]); + if(deleteFile){ + var query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, kony.sync.blobStoreManagerTable); + var wcs = [{ + key: kony.sync.blobManager.id, + value: blobid, + comptype: 'OR' + }]; + + kony.sync.qb_where(query, wcs); + + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + + resultset = kony.db.executeSql(tx, sql, params, errorCallback); + + if(resultset === null || resultset === false ){ + valuesTable = {}; + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.DELETE_FAILED; + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorCallback) + } + + return resultset; + } else{ + valuesTable = {}; + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.DELETE_FAILED; + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorCallback); + } + } else { + var error = kony.sync.getErrorTable( + kony.sync.errorCodeBlobInvalidStateForDelete, + kony.sync.getErrorMessage(kony.sync.errorCodeBlobInvalidStateForDelete, kony.sync.blobManager.states[state]) + ); + errorCallback(error); + + } + } +} +/** + * This method is used to update the binary data referred by id. + * @param id unique id of the base64 value. + * @param base64 is the binary value to be updated. + */ +kony.sync.blobManager.updateBlob = function(tx, blobid, base64, errorCallback) { + + if (blobid === undefined || typeof(blobid) !== "number") { + //TODO - error object create. + var err = {}; + errorCallback(err); + } else { + var blobMeta = kony.sync.blobManager.getBlobMetaDetails(tx, blobid, errorCallback); + //state, status, localPath + var state = null; + if(!kony.sync.isNullOrUndefined(blobMeta)) { + state = blobMeta[kony.sync.blobManager.state]; + } + var possibleStates = [kony.sync.blobManager.INSERT_FAILED, kony.sync.blobManager.FILE_DOESNOT_EXIST, + kony.sync.blobManager.NO_OPERATION, kony.sync.blobManager.UPDATE_FAILED ,kony.sync.blobManager.DOWNLOAD_FAILED, + kony.sync.blobManager.DOWNLOAD_ACCEPTED, kony.sync.blobManager.DOWNLOAD_IN_PROGRESS]; + + if(!kony.sync.isNullOrUndefined(state) && possibleStates.indexOf(state) !== -1) { + var valuesTable = {}; + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.UPDATE_PROCESSING; + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorCallback); + + var isBlobSaved = sync.util.savefile(blobMeta[kony.sync.blobManager.localPath], base64); + + if (isBlobSaved !== null) { + valuesTable = {}; + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.NO_OPERATION; + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorCallback); + return true; + } else { + valuesTable = {}; + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.UPDATE_FAILED; + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorCallback); + return false; + } + } else { + var error = kony.sync.getErrorTable( + kony.sync.errorCodeBlobInvalidStateForUpdate, + kony.sync.getErrorMessage(kony.sync.errorCodeBlobInvalidStateForUpdate, kony.sync.blobManager.states[state]) + ); + errorCallback(error); + } + } +}; + +/** + * This is a utility method used to insert blobvalues to konysyncBLOBSTOREMANAGER and return + * corresponding blobids + * @param tx transaction id + * @param tbname tablename + * @param values table columns + * @return object containing columns and their blob indices + */ +kony.sync.blobstore_insert = function(tx, tbname, values, errorCallback) { + var blobStoreIndices = {}; + if(kony.sync.isNullOrUndefined(kony.sync.scopes.syncScopeBlobInfoMap[tbname])){ + return blobStoreIndices; + } + var binaryColumns = kony.sync.scopes.syncScopeBlobInfoMap[tbname][kony.sync.columns]; + var binaryColumnsLength = binaryColumns.length; + var binaryColumnName = null; + var blobIndex = null; + for(var i=0; i 0) { + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + if (!kony.sync.isNullOrUndefined(rowItem[konysyncBinaryColumn])) { + blobIndex = rowItem[konysyncBinaryColumn]; + var results = kony.sync.blobManager.updateBlob(tx, blobIndex, values[binaryColumnName], + function (err) { + kony.print("error in updateBlob " + JSON.stringify(err)); + }); + if(!results) { + return; + } + blobStoreIndices[binaryColumnName] = blobIndex; + } + } + } + } + return blobStoreIndices; +}; + +/** + * This is a utility method used to delete blob from konysyncBLOBSTOREMANAGER + * @param tx transaction id + * @param tbname tablename + * @param isBatch indicates whether utility function is used for batch or not + * @return + */ +kony.sync.blobstore_delete = function(tx, tbname, wc, isBatch) { + if(kony.sync.isNullOrUndefined(kony.sync.scopes.syncScopeBlobInfoMap[tbname])){ + return; + } + var binaryColumns = kony.sync.scopes.syncScopeBlobInfoMap[tbname][kony.sync.columns]; + var isDeleteSuccessful = true; + var query_compile = null; + var sql = null; + var params = null; + for(var i=0; i 0) { + var blobIndex = null; + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + if (!kony.sync.isNullOrUndefined(rowItem[konysyncBinaryColumn])) { + blobIndex = rowItem[konysyncBinaryColumn]; + } + if(blobIndex) { + var results = kony.sync.blobManager.deleteBlob(tx, blobIndex, function (err) { + kony.print("error in deleteblob " + JSON.stringify(err)); + }); + sync.log.trace("results from deleteBlob " + results); + if (!results) { + isDeleteSuccessful = false; + } + } + } + } + return isDeleteSuccessful; +}; + +/** + * Success callback called after successful completion of download. + * @param response - contains the response from download manager. (blobid, value file/base64). + */ +kony.sync.blobManager.onDemandUniversalSuccessCallback = function(response) { + sync.log.trace(" Entered into kony.sync.blobManager.onDemandUniversalSuccessCallback "+JSON.stringify(response)); + if(response.hasOwnProperty("blobid")) { + var successResponse = {}; + var blobId = parseInt(response.blobid); + var filePath = response.filePath; + + kony.sync.blobManager.updateStatusAfterDownload(blobId, filePath, true); + //give the response to the user. + var blobType = kony.sync.blobManager.getRegisteredBlobType(blobId); + if (!kony.sync.isNullOrUndefined(blobType)) { + + successResponse.pkTable = kony.sync.blobManager.getRegisteredPkTable(blobId); + if (blobType === kony.sync.BlobType.FILE) + successResponse.filePath = response.filePath; + else { + var base64String = sync.util.getallbase64([response.filePath]); + successResponse.base64 = base64String[0]; + } + var successNotifier = kony.sync.blobManager.getRegisteredSuccessCallback(blobId); + //clean up binarynotifier map.. + + successNotifier(successResponse); + } else { + //log download completed.. + sync.log.info("Download completed for blob id " + blobId); + } + } +}; + + +/** + * Failure callback after error in download. + * @param response - contains the error object and the corresponding blob id. + */ +kony.sync.blobManager.onDemandUniversalErrorCallback = function(response) { + sync.log.error("universal error callback " + JSON.stringify(response)); + if(response.hasOwnProperty("blobid")) { + var errorNotifier = kony.sync.blobManager.getRegisteredErrorCallback(response.blobid); + if (!kony.sync.isNullOrUndefined(errorNotifier)) { + kony.sync.blobManager.updateStatusAfterDownload(response.blobid, "" ,false); + + errorNotifier(response); + } + } +}; + +/** Method used to register success and error callbacks for given blob download. + * + * @param blobid - blobid which is under download + * @param pks - primary key values which uniquely identify the blob in parent table + * @param successNotifier - success callback to be called after successful download + * @param errorNotifier - error callback to be called in case of failure. + */ +kony.sync.blobManager.registerCallbacks = function(blobid, pks, blobType, successNotifier, errorNotifier){ + kony.sync.blobManager.binaryNotifierMap[blobid] = [pks, blobType, successNotifier, errorNotifier]; +}; + +/** + * Method returns the registered Success callback for the given blobid download request. + * @param blobid - blobid which is under download. + * @returns {*} + */ +kony.sync.blobManager.getRegisteredSuccessCallback = function(blobid) { + if(kony.sync.blobManager.binaryNotifierMap.hasOwnProperty(blobid)) { + return kony.sync.blobManager.binaryNotifierMap[blobid][2]; + } else { + return null; + } +}; + +/** + * Method returns the registered error callback for the given blobid download request. + * @param blobid - blobid which is under download. + * @returns {*} + */ +kony.sync.blobManager.getRegisteredErrorCallback = function(blobid) { + if(kony.sync.blobManager.binaryNotifierMap.hasOwnProperty(blobid)) { + return kony.sync.blobManager.binaryNotifierMap[blobid][3]; + } else { + return null; + } +}; + +/** + * Method returns the registered pk values for the given blobid download request. + * @param blobid - blobid which is under download. + * @returns {*} + */ +kony.sync.blobManager.getRegisteredPkTable = function(blobid) { + if(kony.sync.blobManager.binaryNotifierMap.hasOwnProperty(blobid)) { + return kony.sync.blobManager.binaryNotifierMap[blobid][0]; + } else { + return null; + } +}; + +kony.sync.blobManager.getRegisteredBlobType = function(blobid) { + if(kony.sync.blobManager.binaryNotifierMap.hasOwnProperty(blobid)) { + return kony.sync.blobManager.binaryNotifierMap[blobid][1]; + } else { + return null; + } +}; + +/** + * Method used to update status of the blob record to completed after completion of donwload. + * @param blobid - id for which the status has to be updated. + * @param success - result of operation (true/ false). + */ +kony.sync.blobManager.updateStatusAfterDownload = function(blobid, filePath, success) { + + function single_transaction_callback(tx) { + sync.log.trace(" kony.sync.blobManager.updateStatusAfterDownload: single_transaction_callback ", blobid); + var valuesTable = {}; + if(success) { + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.NO_OPERATION; + valuesTable[kony.sync.blobManager.status] = 100; + } else { + valuesTable[kony.sync.blobManager.state] = kony.sync.blobManager.DOWNLOAD_FAILED; + valuesTable[kony.sync.blobManager.status] = 0; + } + valuesTable[kony.sync.blobManager.localPath] = filePath; + + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable); + } + + function single_transaction_success_callback() { + sync.log.trace("updateStatusAfterDownload -> transaction success"); + } + + function single_transaction_error_callback() { + sync.log.trace("updateStatusAfterDownload -> transaction failure"); + } + + var connection = kony.sync.getConnectionOnly(kony.sync.syncConfigurationDBName, kony.sync.syncConfigurationDBName); + + if(connection !== null) { + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, + single_transaction_error_callback); + } +}; + + + +/** + * Method invokes download operation on the given record. + * Method invokes download operation on the given record. + * @param tx - transaction id + * @param tableName - parent table name for the blob reocrd + * @param columnName - column name of the binary field. + * @param blobType - download response type . (FILE /BASE64). + * @param pks - pk table which uniquely identifies the record + * @param successNotifier - success callback for download request. + * @param errorNotifier - error callback for download request. + * @returns {null} + */ +kony.sync.blobManager.triggerDownload = function(tx, tableName, columnName, blobType, pks, successNotifier, errorNotifier) { + + var query = kony.sync.qb_createQuery(); + var state = kony.sync.blobManager.DOWNLOAD_ACCEPTED; + + kony.sync.qb_set(query, { + localPath: "", + status: 0, + state: state, + type: "base64", + tableName : tableName, + columnName : columnName, + lastUpdatedTimeStamp: 'now()' + }); + + kony.sync.qb_insert(query, kony.sync.blobStoreManagerTable); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + resultset = kony.sync.executeSql(tx, sql, params, errorNotifier); + + if (resultset === null || resultset === false) + return null; + + var blobId = resultset.insertId; +// {pktable : {key1 : value1,...}, response: filepath / base64} + kony.sync.blobManager.registerCallbacks(blobId,pks, blobType, successNotifier, errorNotifier); + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tableName); + var setClause = {}; + var blobMetaFieldKey = kony.sync.binaryMetaColumnPrefix+columnName; + setClause[blobMetaFieldKey] = blobId; + kony.sync.qb_set(query, setClause); + var wcs = []; + for (var key in pks) { + var wc = {}; + wc.key = key; + wc.value = pks[key]; + wcs.push(wc); + } + kony.sync.qb_where(query, wcs); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + resultset = kony.sync.executeSql(tx, sql, params); + if(resultset === false) { + sync.log.error("Error in kony.sync.blobManager.triggerDownload "); + } + sync.util.notifyOnDemandPolling(); +}; + +/** + * Method retriggers the download (incase of force-download / failed download.) + * @param tx - transaction id + * @param blobid - id which uniquely identifies the blob + * @param blobType - download response type (FILE/ base64). + * @param pks - pk table which uniquely identifies the record. + * @param successNotifier - success callback for download request. + * @param errorNotifier - error callback for download request. + */ +kony.sync.blobManager.retryDownload = function(tx, blobid, blobType, pks, successNotifier, errorNotifier) { + //reset the state and status to 0% and DOWNLOAD_ACCEPTED + + var state = kony.sync.blobManager.DOWNLOAD_ACCEPTED; + + var valuesTable = {}; + valuesTable[kony.sync.blobManager.state] = state; + valuesTable[kony.sync.blobManager.status] = 0; + + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorNotifier); + kony.sync.blobManager.registerCallbacks(blobid, pks, blobType, successNotifier, errorNotifier); + + sync.util.notifyOnDemandPolling(); + +}; + + + +kony.sync.blobManager.getBlobInline = function(tx, blobid, blobType, tableName, columnName, config, pks, + successNotifier, errorNotifier) { + + var blobMeta = kony.sync.blobManager.getBlobMetaDetails(tx, blobid, errorNotifier); + + if(blobMeta[kony.sync.blobManager.status] === 100 && + blobMeta[kony.sync.blobManager.state] === kony.sync.blobManager.NO_OPERATION) { + //base64 exists. return back the required details. + var successResponse = {}; + successResponse.pkTable = pks; + + if (blobType === kony.sync.BlobType.FILE) { + //return blobMeta[kony.sync.blobManager.localPath]; + successResponse.filePath = blobMeta[kony.sync.blobManager.localPath]; + successNotifier(successResponse); + + } else { + var base64String = sync.util.getallbase64([blobMeta[kony.sync.blobManager.localPath]]); + if (base64String[0].length > 0) { + successResponse.base64 = base64String[0]; + successNotifier(successResponse); + } else { + //update the state of the file stating the file doesn't exist. + var valuesTable = {}; + valuesTable.state = kony.sync.blobManager.FILE_DOESNOT_EXIST; + + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorNotifier); + + //throw an error saying file doesn't exist. + var error = kony.sync.getErrorTable( + kony.sync.errorCodeBlobFileDoesnotExist, + kony.sync.getErrorMessage(kony.sync.errorCodeBlobFileDoesnotExist) + ); + + errorNotifier(error); + } + } + } else { + //invalid state.. + //TODO - what should be done. - clean up? + var error = kony.sync.getErrorTable( + kony.sync.errorCodeBlobInvalidState, + kony.sync.getErrorMessage(kony.sync.errorCodeBlobInvalidState) + ); + + errorNotifier(error); + + } +}; +/** + * Method called when download request is invoked. + * @param tx - transaction id + * @param blobid - id of the blob store manager record. + * @param blobType - response type (FILE / BASE64). + * @param tableName - name of the parent table. + * @param columnName - binary column to which the record refers to. + * @param config - configuration parameters for download ( forceDownload). + * @param pks - pk table that uniquely identies the record in parent table. + * @param successNotifier - success callback for fetch + * @param errorNotifier - error callback for fetch, + * @returns {*} + */ +kony.sync.blobManager.getBlobOnDemand = function(tx, blobid, blobType, tableName, columnName, config, pks, + successNotifier, errorNotifier) { + //no blob id. trigger download + if(kony.sync.isNullOrUndefined(blobid)) { + kony.sync.blobManager.triggerDownload(tx, tableName, columnName,blobType, pks ,successNotifier, errorNotifier); + } else { + //check if the file is available. + var blobMeta = kony.sync.blobManager.getBlobMetaDetails(tx, blobid, errorNotifier); + + if(blobMeta.hasOwnProperty(kony.sync.blobManager.state) && + blobMeta.hasOwnProperty(kony.sync.blobManager.status)) { + var forceDownload = false; + + if(!kony.sync.isNullOrUndefined(config) && config.hasOwnProperty('forceDownload')) { + forceDownload = config.forceDownload; + } + //if state is No_operation and status is 100, file exists. read it and return. + if(blobMeta[kony.sync.blobManager.status] === 100 && + blobMeta[kony.sync.blobManager.state] === kony.sync.blobManager.NO_OPERATION) { + //base64 exists. return back the required details. + if(!forceDownload) { + var successResponse = {}; + successResponse.pkTable = pks; + if (blobType === kony.sync.BlobType.FILE) { + //return blobMeta[kony.sync.blobManager.localPath]; + + successResponse.filePath = blobMeta[kony.sync.blobManager.localPath]; + successNotifier(successResponse); + return; + } else { + var base64String = sync.util.getallbase64([blobMeta[kony.sync.blobManager.localPath]]) + if (base64String[0].length > 0) { + successResponse.base64 = base64String[0]; + successNotifier(successResponse); + return; + } else { + var valuesTable = {}; + valuesTable.state = kony.sync.blobManager.FILE_DOESNOT_EXIST; + + kony.sync.blobManager.updateBlobManager(tx, blobid, valuesTable, errorNotifier); + + //throw an error saying file doesn't exist. + var error = kony.sync.getErrorTable( + kony.sync.errorCodeBlobFileDoesnotExist, + kony.sync.getErrorMessage(kony.sync.errorCodeBlobFileDoesnotExist) + ); + + errorNotifier(error); + return; + } + } + } else { + //retrigger download.. + kony.sync.blobManager.retryDownload(tx, blobid, blobType, pks, successNotifier, errorNotifier); + } + } + //if already download requested on that record, throw an error.. + else if(blobMeta[kony.sync.blobManager.state] === kony.sync.blobManager.DOWNLOAD_ACCEPTED || + blobMeta[kony.sync.blobManager.state] === kony.sync.blobManager.DOWNLOAD_IN_PROGRESS) { + //throw an error download already requested... + var error = kony.sync.getErrorTable( + kony.sync.errorCodeDownloadAlreadyInQueue, + kony.sync.getErrorMessage(kony.sync.errorCodeDownloadAlreadyInQueue) + ); + errorNotifier(error); + return; + + } else { + //retriger download + kony.sync.blobManager.retryDownload(tx, blobid, blobType, pks, successNotifier, errorNotifier); + } + } + } +}; + +/** + * Method used to read meta info about the record in blobstore manager. + * @param tx - transaction id. + * @param blobid - id of the record in blob store manager. + * @param errorCallback - error callback for unsuccesful transactions. + * @returns {{}} JSON object with state and status information. + */ +kony.sync.blobManager.getBlobMetaDetails = function(tx, blobid, errorCallback) { + var wcs = [{ + key : "id", + value : blobid + }]; + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_from(query, kony.sync.blobStoreManagerTable); + + kony.sync.qb_where(query, wcs); + kony.sync.qb_select(query, [kony.sync.blobManager.state, kony.sync.blobManager.status, + kony.sync.blobManager.localPath]); + + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + + var response = {}; + + resultset = kony.db.executeSql(tx, sql, params, function(err) { + kony.print("err in fetch " + JSON.stringify(err)); + errorCallback(err); + }); + + if(resultset !== null && resultset !== false) { + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + response.state = rowItem[kony.sync.blobManager.state]; + response.status = rowItem[kony.sync.blobManager.status]; + response.localPath = rowItem[kony.sync.blobManager.localPath]; + } + return response; +}; + +/** + * This method is used to get the fetch the rows from blob tables and populate the ondemand download request + * @return + */ +kony.sync.blobManager.getNextOnDemandJob = function(){ + var successcallback = sync.util.processjobs; + var errorcallback = function(err) { + kony.print("error callback in getNextOnDemandJob "+JSON.stringify(err)); + } + sync.log.trace("Entering kony.sync.blobManager.getNextOnDemandJob "); + + var payloadList = []; + + var isError = false; + var errorInfo = {}; + + function single_transaction_success_callback() { + if(isError) { + kony.sync.verifyAndCallClosure(errorcallback, errorInfo); + return; + } + sync.log.trace("Entering kony.sync.blobManager.getNextOnDemandJob->single_select_transaction_success"); + + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams) && !kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.authTokenKey])) { + if (!kony.sync.isMbaasEnabled) { + kony.sync.isMbaasEnabled = true; + } + kony.sdk.claimsRefresh(claimsRefreshSuccessCallBack, claimsRefreshFailureCallBack); + } else { + kony.sync.verifyAndCallClosure(successcallback, payloadList); + } + } + + function claimsRefreshSuccessCallBack() { + var currentClaimToken = kony.sdk.getCurrentInstance().currentClaimToken; + if (kony.sync.currentSyncConfigParams[kony.sync.authTokenKey] != currentClaimToken) { + kony.sync.currentSyncConfigParams[kony.sync.authTokenKey] = currentClaimToken; + } + var payloadListSize = payloadList.length; + var payload = null; + for(var i=0; isingle_select_transaction_failed"); + kony.sync.verifyAndCallClosure(errorcallback); + } + + function populateOnDemandPayload(tx, rowItemsList) { + try { + var rowItemsListLength = rowItemsList.length; + var binaryMetaColumnName = null; + var binaryColumnName = null; + var binaryTableName = null; + var rowItem = null; + var query = null; + var query_compile = null; + var sql = null; + var params = null; + var resultSet = null; + var resultSetLength = null; + var whereClause = []; + var queryOpenBrace = true; + var blobId = null; + //Iterating over the rows which have status as 0% and state as DOWNLOAD_ACCEPTED and selecting the binaryrow column which has + // payload like headers etc etc and inserting into payload list + for(var j=0; j < rowItemsListLength; j++) { + rowItem = rowItemsList[j]; + binaryColumnName = rowItem[kony.sync.blobManager.columnName]; + binaryTableName = rowItem[kony.sync.blobManager.tableName]; + query = kony.sync.qb_createQuery(); + var scope = kony.sync.scopes[kony.sync.scopes.syncTableScopeDic[binaryTableName]]; + var columns = kony.sync.createClone( scope.syncTableDic[binaryTableName].Pk_Columns ); + columns.push(binaryColumnName); + kony.sync.qb_select(query, columns); + kony.sync.qb_from(query, binaryTableName); + wcs = []; + binaryMetaColumnName = kony.sync.binaryMetaColumnPrefix + binaryColumnName; + blobId = rowItem[kony.sync.blobManager.id]; + kony.table.insert(wcs, {key:binaryMetaColumnName,value:blobId,optype: "EQ"}); + kony.sync.qb_where(query, wcs); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet === false) { + isError = true; + return; + } + if(resultSet !== null && resultSet.rows.length > 0) { + resultSetLength = resultSet.rows.length; + var data = null; + for(var k=0; k 0) { + rowItem = kony.db.sqlResultsetRowItem(tx, resultSet, 0); + } + return rowItem; + } + + function single_transaction_callback(tx) { + try { + //Select id, tablename, columnname from blobstoremanager table with status as 0% and state as DOWNLOAD_ACCEPTED + var query = null; + var query_compile = null; + var sql = null; + var params = null; + var resultSet = null; + query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, [kony.sync.blobManager.id, kony.sync.blobManager.tableName, kony.sync.blobManager.columnName]); + kony.sync.qb_from(query, kony.sync.blobStoreManagerTable); + var wcs = []; + + kony.table.insert(wcs, {key:kony.sync.blobManager.status,value:0,optype: "EQ", comptype:"AND"}); + kony.table.insert(wcs, {key:kony.sync.blobManager.state,value:kony.sync.blobManager.DOWNLOAD_ACCEPTED,optype:"EQ", comptype:"OR"}); + //TODO: pick latest rows based on timestamp + kony.sync.qb_where(query, wcs); + kony.sync.qb_limitOffset(query, kony.sync.blobManager.ONDEMAND_FETCH_LIMIT, kony.sync.blobManager.ONDEMAND_FETCH_OFFSET); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet === false) { + isError = true; + return; + } + var rowItemsList = []; + var rowItem = null; + var resultSetLength = null; + if(resultSet !== null && resultSet.rows.length > 0) { + resultSetLength = resultSet.rows.length; + for(var i=0; i < resultSetLength; i++) { + rowItem = kony.db.sqlResultsetRowItem(tx, resultSet, i); + if(!kony.sync.isNullOrUndefined(rowItem)) { + rowItemsList.push(rowItem); + } + } + populateOnDemandPayload(tx, rowItemsList); + } + }catch(err) { + sync.log.error("kony.sync.blobManager.getNextOnDemandJob->exception occured "+JSON.stringify(err)); + //errorcallback(err); + isError = true; + errorInfo = err; + } + } + + var connection = kony.sync.getConnectionOnly(kony.sync.syncConfigurationDBName, kony.sync.syncConfigurationDBName, errorcallback); + + if(connection !== null) { + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback); + } +}; +// **************** End BlobStoreManager.js****************** +// **************** End KonySyncBlobStoreManager.js******************* + + +// **************** Start KonySyncBlobUtils.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} + +/** + * Method returns the download policy of the given column in the table if the type of column is binary + * else returns null + * @param tableName - tablename + * @param columnName - column name + * @returns {*} -downloadPolicy for binary column, null for non binary columns. + */ +kony.sync.getDownloadPolicy = function(tableName, columnName) { + + var downloadPolicy = null; + if(!kony.sync.isNullOrUndefined(kony.sync.scopes) && kony.sync.scopes.syncTableScopeDic.hasOwnProperty(tableName)) { + var scope = kony.sync.scopes[kony.sync.scopes.syncTableScopeDic[tableName]]; + var tableColumns = scope.syncTableDic[tableName].Columns; + var isColumn = false; + for (var i = 0; i < tableColumns.length; i++) { + if (tableColumns[i].Name === columnName && tableColumns[i].type === "binary") { + isColumn = true; + if (tableColumns[i].hasOwnProperty("BinaryPolicy")) { + downloadPolicy = tableColumns[i].BinaryPolicy; + } else { + downloadPolicy = kony.sync.inline; + } + break; + } + }; + } + return downloadPolicy; + +}; + +/** + * Method checks whether the given column in binary column or not. + * @param tbname - table to which column belongs to. + * @param columnName - name of the column + * @returns {number|Number} - returns -1 if the column is not binary. + */ +kony.sync.isBinaryColumn = function(tbname, columnName) { + var binaryColumnsOfTable = kony.sync.scopes.syncScopeBlobInfoMap[tbname][kony.sync.columns]; + + return binaryColumnsOfTable.indexOf(columnName); +}; + +/** + * Method used to find Blobref for the given record. + * @param tx - transaction id + * @param sql - sql statement + * @param params - sql params + * @param column - column name + * @param errorNotifier - error callback. + * @returns {{}} - blobref object containing pk values and blobreference. + */ + +kony.sync.getBlobRef = function(tx, tableName, columnName, pks, errorNotifier) { + var wcs = []; + + for (var key in pks) { + var wc = {}; + wc.key = key; + wc.value = pks[key]; + + wcs.push(wc); + } + var query = kony.sync.qb_createQuery(); + kony.sync.qb_from(query, tableName); + var blobRefColumn = kony.sync.binaryMetaColumnPrefix + columnName; + kony.sync.qb_select(query, [blobRefColumn]); + kony.sync.qb_where(query, wcs); + + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + + var blobRef = -1; + + var result = kony.db.executeSql(tx, sql, params, function (err) { + kony.print("error in transaction call back " + JSON.stringify(err)); + errorNotifier(err); + return; + }); + + if(result !== null && result !== false) { + if(result.rows.length > 0) { + var rowItem = kony.db.sqlResultsetRowItem(tx, result, 0); + blobRef= rowItem[kony.sync.binaryMetaColumnPrefix+columnName]; + } + } + return blobRef; + +} + +/** + * Method used to validate pkTable. + * @param pkColumns - pkColumns related to the table + * @param pkTable - received pkTable from the user. + * @returns {*} - updated pkTable after removing non binary keys. + * returns null incase all the pk keys are not sent. + */ + +kony.sync.validatePkTable = function(pkColumns, pkTable) { + + var receivedPkColumns = Object.keys(pkTable); + //remove non pk columns.. + for(var i = receivedPkColumns.length - 1; i > 0 ; i--) { + if(pkColumns.indexOf(receivedPkColumns(i)) === -1) { + delete pkTable[receivedPkColumns[i]]; + receivedPkColumns.splice(i , 1); + } + } + + //check if info is received for all pks. + if(receivedPkColumns.length !== pkColumns.length) { + //throw an error. info about all pks is mandate. + return null; + } else { + return pkTable; + } +}; +// **************** End KonySyncBlobUtils.js******************* + + +// **************** Start KonySyncChunkingHelper.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} + +if(typeof(sync)=== "undefined"){ + sync = {}; +} + +//Checks whether download response is eligible for chunking or not +kony.sync.eligibleForChunking = function(result){ + sync.log.trace("Entering kony.sync.eligibleForChunking"); + if(!kony.sync.isNull(result.opstatus) && result.opstatus !== 0){ + return false; + } + return (!kony.sync.isNull(result.d) && + result.d.error === "false" && !kony.sync.isNull(result.d.__sync[kony.sync.payloadIdKey])); +}; + +//Add chunk info in metatable +kony.sync.startChunking = function(url, serviceParams, result, callback){ + sync.log.trace("Entering kony.sync.startChunking"); + sync.log.info("storing payload info in konysyncchunkmetainfo"); + var isError = false; + var payloadId = result.d.__sync[kony.sync.payloadIdKey]; + var chunkCount = result.d.__sync[kony.sync.chunkCountKey]; + var hashSum = result.d.__sync[kony.sync.chunkHashSum]; + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, transactionFailedCallback); + if(dbconnection!==null){ + kony.db.transaction(dbconnection, transactionCallback, transactionFailedCallback, transactionSuccessCallback); + } + + function transactionCallback(tx){ + sync.log.trace("Entering kony.sync.startChunking->transactionCallback"); + //clear meta data from chunking table + if(kony.sync.clearChunkMetaData(tx, kony.sync.currentScope[kony.sync.scopeName])===false){ + isError = true; + return; + } + + //store payload info in konysyncchunkmetainfo + var values = {}; + values[kony.sync.metaTablePayloadId] = payloadId; + values[kony.sync.metaTableChunkSize] = kony.sync.getChunkSize(); + values[kony.sync.metaTableChunkAck] = kony.sync.chunkNotAcknowledged; + values[kony.sync.metaTableChunkHashSum] = hashSum; + values[kony.sync.metaTableChunkDiscarded] = kony.sync.chunkNotDiscarded; + values[kony.sync.metaTableChunkCount] = chunkCount; + values[kony.sync.metaTableScopeColumn] = kony.sync.currentScope[kony.sync.scopeName]; + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, values); + kony.sync.qb_insert(query, kony.sync.chunkMetaTableName); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + } + } + //call callback with framed error + function transactionFailedCallback(){ + sync.log.trace("Entering kony.sync.startChunking->transactionFailedCallback"); + if(isError){ + sync.log.error("Error occurred while inserting chunk information in metatable"); + callback(kony.sync.frameDownloadError(null, null, 1)); + } + else{ + var errMsg = "Error occurred while opening transaction to store chunk information in metatable"; + sync.log.error(errMsg); + callback(kony.sync.frameDownloadError(null, errMsg, 2)); + } + } + + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.startChunking->transactionSuccessCallback"); + kony.sync.downloadChunks(url, serviceParams, payloadId, chunkCount, hashSum, result, false, null, callback); + } +}; + +//Starts Chunking +kony.sync.downloadChunks = function(url, serviceParams, payloadId, chunkCount, hashSum, initialData, isResumed, downloadedChunks, callback){ + sync.log.trace("Entering kony.sync.downloadChunks"); + if(kony.sync.isSyncStopped){ + kony.sync.stopSyncSession(); + return; + } + var retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + var serverParams = {}; + serviceParams[kony.sync.payloadIdKey] = payloadId; + serviceParams[kony.sync.chunkCountKey] = chunkCount; + var noOfParallelCalls = 1; + //temporarily disabling parallel calls + /*if(!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.maxParallelChunksKey])){ + if(kony.sync.currentSyncConfigParams[kony.sync.maxParallelChunksKey] > 0){ + noOfParallelCalls = kony.sync.currentSyncConfigParams[kony.sync.maxParallelChunksKey]; + } + }*/ + //sync.log.info("Maximum parallel chunks:" + noOfParallelCalls); + var chunkingFailed = 0; + var chunkProcessed = 0; + var chunkErrorMap = {}; + var utf8data = null; + var corruptedData = false; + var callNo = 0; + var infoObj = {}; + var i = null; + //process first chunk if chunking is not resumed from an earlier point + if(!isResumed){ + downloadNetworkCallback(initialData, 1); + } + + /*if(!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey])){ + //infoObj[kony.sync.numberOfRetriesKey] = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + }*/ + if(isResumed){ + //find the remaining ids + + //create map for all the ids + var chunkMap = {}; + for(i=1; i<=chunkCount; i++){ + chunkMap[i] = 0; //initially set 0 for all the ids + } + for(i in downloadedChunks){ + chunkMap[downloadedChunks[i]] = 1; //set 1 for downloaded ids + chunkProcessed++; //count processed chunks + } + + i=1; + for(callNo=1; callNo<=chunkCount; callNo++){ + if(chunkMap[callNo]===0){ + infoObj[kony.sync.chunkNoKey] = callNo; + serviceParams[kony.sync.chunkNoKey] = callNo; + kony.sync.callOnChunkStart(chunkCount, payloadId, kony.sync.currentScope[kony.sync.scopeName], callNo, serviceParams); + sync.log.info("Hitting the service with URL :" + url + " with params:" + JSON.stringify(serviceParams)); + retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + kony.sync.invokeServiceAsync(url, serviceParams, downloadNetworkCallbackStatus, infoObj); + if(i>=noOfParallelCalls){ + callNo++; + break; + } + i++; + } + } + } + else{ + for(callNo=2; callNo<=chunkCount; callNo++){ + infoObj[kony.sync.chunkNoKey] = callNo; + serviceParams[kony.sync.chunkNoKey] = callNo; + kony.sync.callOnChunkStart(chunkCount, payloadId, kony.sync.currentScope[kony.sync.scopeName], callNo, serviceParams); + sync.log.info("Hitting the service with URL :" + url + " with params:" + JSON.stringify(serviceParams)); + retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + kony.sync.invokeServiceAsync(url, serviceParams, downloadNetworkCallbackStatus, infoObj); + if(callNo > noOfParallelCalls){ + callNo++; + break; + } + } + } + + + function downloadNetworkCallbackStatus(status, result, info){ + if(status === 400){ + sync.log.trace("Entering kony.sync.downloadChunks->downloadNetworkCallbackStatus"); + sync.log.info("Got Response for Chunk No:" + info[kony.sync.chunkNoKey]); + if(kony.sync.eligibleForRetry(result.opstatus, retries)){ + retries--; + kony.sync.retryServiceCall(url, result, info, retries, downloadNetworkCallback, serviceParams); + } + else{ + kony.sync.setSessionID(result); + downloadNetworkCallback(result, info[kony.sync.chunkNoKey]); + } + }else if(status === 300){ + downloadNetworkCallback(kony.sync.getNetworkCancelError(),info[kony.sync.chunkNoKey]); + } + } + + function downloadNetworkCallback(result, info){ + sync.log.trace("Entering kony.sync.downloadChunks->downloadNetworkCallback"); + serverParams[kony.sync.hostName] = kony.sync.getServerDetailsHostName(result); + serverParams[kony.sync.ipAddress] = kony.sync.getServerDetailsIpAddress(result); + if(callNo <= chunkCount){ + if(!isResumed){ + if(callNo !== 0){ + infoObj[kony.sync.chunkNoKey] = callNo; + serviceParams[kony.sync.chunkNoKey] = callNo; + kony.sync.callOnChunkStart(chunkCount, payloadId, kony.sync.currentScope[kony.sync.scopeName], callNo, serviceParams); + sync.log.info("Hitting the service with URL :" + url + " with params:", serviceParams); + retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + kony.sync.invokeServiceAsync(url, serviceParams, downloadNetworkCallbackStatus, infoObj); + callNo++; + } + } + else{ + for(; callNo<=chunkCount; callNo++){ + if(chunkMap[callNo]===0){ + infoObj[kony.sync.chunkNoKey] = callNo; + serviceParams[kony.sync.chunkNoKey] = callNo; + kony.sync.callOnChunkStart(chunkCount, payloadId, kony.sync.currentScope[kony.sync.scopeName], callNo, serviceParams); + sync.log.info("Hitting the service with URL :" + url + " with params:", serviceParams); + retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + kony.sync.invokeServiceAsync(url, serviceParams, downloadNetworkCallbackStatus, infoObj); + if(callNo >= noOfParallelCalls + 1){ + callNo++; + break; + } + } + } + } + } + var chunkId = info; + if(kony.sync.isValidJSTable(info)){ + chunkId = info[kony.sync.chunkNoKey]; + } + + if(!kony.sync.isNull(result.opstatus) && result.opstatus !== 0){ + chunkingFailed++; + sync.log.error("Error occurred while downloading chunks: Code=" + result.opstatus + ", message=" + result.errmsg); + chunkErrorMap[chunkId] = result.errmsg; + kony.sync.callOnChunkError(chunkCount, payloadId, kony.sync.currentScope[kony.sync.scopeName], chunkId, chunkCount - chunkProcessed, chunkProcessed, result.opstatus, result.errmsg, serverParams); + if(allChunksProcessed()){ + handleError(); + } + } + else if(result.d.error === "true"){ + chunkingFailed++; + sync.log.error("Error occurred while downloading chunks: message=" + result.d.msg); + chunkErrorMap[chunkId] = result.d.msg; + kony.sync.callOnChunkError(chunkCount, payloadId, kony.sync.currentScope[kony.sync.scopeName], chunkId, chunkCount - chunkProcessed, chunkProcessed, kony.sync.errorCodeUnknownServerError, result.d.msg, serverParams); + if(allChunksProcessed()){ + handleError(); + } + } + else{ + //store in local DB + kony.sync.storeChunkInDB(payloadId, chunkId, result.d[kony.sync.chunkDataKey], kony.sync.currentScope[kony.sync.scopeName], chunkDataStoredCallback); + if(allChunksProcessed()){ + handleError(); + } + } + } + + function allChunksProcessed(){ + return chunkProcessed + chunkingFailed === chunkCount; + } + function handleError(){ + sync.log.info("All chunking calls for current batch with total of " + chunkCount + " completed.") + if(chunkProcessed > 0){ + sync.log.info("Chunks successfully downloaded and stored in DB:" + chunkProcessed); + } + //error occurred in one or more chunks + if(chunkingFailed > 0){ + sync.log.error("Chunks failed either to downloaded or while storing in DB:" + chunkingFailed); + //frame error + var framedErrorResponse = kony.sync.frameDownloadError(kony.sync.getErrorMessage(kony.sync.errorCodeChunking), chunkErrorMap, null, kony.sync.errorCodeChunking); + sync.log.error(kony.sync.getErrorMessage(kony.sync.errorCodeChunking), chunkErrorMap); + //call download complete callback with error + callback(framedErrorResponse); + return false; + }else{ + return true; + } + } + + + function chunkDataStoredCallback(chunkId, errorMap){ + sync.log.trace("Entering kony.sync.downloadChunks->chunkDataStoredCallback"); + //if error, add to errorMap + if(!kony.sync.isNull(errorMap)){ + chunkingFailed++; + chunkErrorMap[chunkId] = errorMap.errorCode; + sync.log.error("Error occurred while storing chunk " + chunkId + " in DB"); + kony.sync.callOnChunkError(chunkCount, payloadId, kony.sync.currentScope[kony.sync.scopeName], chunkId, chunkCount - chunkProcessed, chunkProcessed, errorMap.errorCode, errorMap.errorMessage, serverParams, errorMap.errorInfo); + } + else{ + chunkProcessed++; + kony.sync.callOnChunkSuccess(chunkCount, payloadId, kony.sync.currentScope[kony.sync.scopeName], chunkId, chunkCount - chunkProcessed, chunkProcessed, serverParams); + } + + if(allChunksProcessed() && handleError()){ + //gather all results from chunkMap + kony.sync.getChunksFromDB(payloadId, chunkCount, kony.sync.currentScope[kony.sync.scopeName], chunkDataProcessCallback); + } + + } + + function chunkDataProcessCallback(data, isError, errorType){ + sync.log.trace("Entering kony.sync.downloadChunks->chunkDataProcessCallback"); + //error occurred while retrieving info + if(isError){ + //frame error + sync.log.error(kony.sync.getErrorMessage(kony.sync.errorCodeChunking), data); + var framedErrorResponse = null; + if(errorType===1 || errorType===2){ + framedErrorResponse = kony.sync.frameDownloadError(null, null, errorType); + }else{ + framedErrorResponse = kony.sync.frameDownloadError(kony.sync.getErrorMessage(kony.sync.errorCodeChunking), data, null, kony.sync.errorCodeChunking); + } + //call download complete callback with error + callback(framedErrorResponse); + } + //all chunks downloaded successfully + else{ + utf8data = data; + + //calculate checksum hash of utf8data; + var checksum = kony.sync.createHash("sha256", utf8data); + + //compare checksum with server sent hashsum; + if(!kony.string.equalsIgnoreCase(checksum, hashSum)){ + sync.log.error("Received corrupted chunk data for payloadId= " + payloadId + ", clearing erroneous chunks from db."); + corruptedData = true; + } + + //release checksum + checksum = null; + + //clear the payload from metainfo; + kony.sync.clearChunkForPayload(payloadId, kony.sync.currentScope[kony.sync.scopeName], corruptedData, chunkDataClearback); + } + } + + function chunkDataClearback(data, isError){ + sync.log.trace("Entering kony.sync.downloadChunks->chunkDataClearback"); + //error occurred while clearing chunkInfo + if(isError || corruptedData){ + //create error message + var errMsg = "Following errors occurred:"; + if(isError){ + errMsg += "Error occurred while clearing chunk information from DB"; + } + if(corruptedData){ + if(isError){ + errMsg += ", "; + } + errMsg += "Received corrupted chunk data for payloadId= " + payloadId; + } + errMsg += "."; + sync.log.error(errMsg); + + //frame error + var framedErrorResponse = kony.sync.frameDownloadError(errMsg, data, null, kony.sync.errorCodeChunking); + + //call download complete callback with error + callback(framedErrorResponse); + } + else{ + //convert json string to json object + var myJsonObject = null; + try{ + myJsonObject = JSON.parse(utf8data); + } + catch(e){ + var errMsg = kony.sync.getErrorMessage(kony.sync.errorCodeParseError,utf8data,e); + sync.log.error(errMsg); + myJsonObject = null; + utf8data = null; + callback(kony.sync.frameDownloadError(errMsg, e, null, kony.sync.errorCodeParseError)); + return; + } + utf8data = null; + //call the callback with final result + callback(myJsonObject); + } + } +}; + +//framing download error +kony.sync.frameDownloadError = function(errorMessage, errorInfo, dbError, errorCode){ + sync.log.trace("Entering kony.sync.frameDownloadError"); + var result = {}; + result.d = {}; + result.d.error = "true"; + if(dbError===1){//statement error + result.d.opstatus = kony.sync.errorObject.errorCode; + result.d.msg = kony.sync.errorObject.errorMessage; + result.d.errorInfo = kony.sync.errorObject.errorInfo; + } + else if(dbError===2){//transaction error + result.d.opstatus = kony.sync.errorCodeTransaction; + result.d.msg = kony.sync.getErrorMessage(kony.sync.errorCodeTransaction); + result.d.errorInfo = kony.sync.errorObject.errorInfo; + sync.log.error(result.d.msg); + } + else{ + result.d.msg = errorMessage; + result.d.errorInfo = errorInfo; + result.d.opstatus = errorCode; + } + return result; +}; + +//This method will store chunks in DB +kony.sync.storeChunkInDB = function(payloadId, chunkId, chunkData, scopeName, callback){ + sync.log.trace("Entering kony.sync.storeChunkInDB"); + var isError = false; + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, transactionFailedCallback); + if(dbconnection!==null){ + kony.db.transaction(dbconnection, transactionCallback, transactionFailedCallback, transactionSuccessCallback); + } + + function transactionCallback(tx){ + sync.log.trace("Entering kony.sync.storeChunkInDB->transactionCallback"); + //check for dupicate chunks + var wcs = []; + wcs.push({key:kony.sync.metaTableScopeColumn, value:scopeName}); + wcs.push({key:kony.sync.chunkTableChunkId, value:chunkId}); + wcs.push({key:kony.sync.chunkTablePayloadId, value:payloadId}); + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_where(query, wcs); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, kony.sync.chunkTableName); + + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(tx, sql, params); + if(resultset===false){ + isError = true; + return; + } + + if(resultset.rows.length > 0){ + //ignore the chunk as it is already stored by some earlier call + return; + } + + //store chunk into DB + var values = {}; + values[kony.sync.chunkTableChunkData] = chunkData; + values[kony.sync.chunkTableChunkId] = chunkId; + values[kony.sync.chunkTablePayloadId] = payloadId; + values[kony.sync.metaTableScopeColumn] = scopeName; + values[kony.sync.chunkTableTimeStamp] = (new Date()).toString(); + query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, values); + kony.sync.qb_insert(query, kony.sync.chunkTableName); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + } + } + + function transactionFailedCallback(){ + sync.log.trace("Entering kony.sync.storeChunkInDB->transactionFailedCallback"); + callback(chunkId, kony.sync.getTransactionError(isError)); + } + + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.storeChunkInDB->transactionSuccessCallback"); + callback(chunkId); + } +}; + +//This method will retrieve all chunks from DB +kony.sync.getChunksFromDB = function(payloadId, chunkCount, scopeName, callback){ + sync.log.trace("Entering kony.sync.getChunksFromDB"); + var isError = false; + var base64 = ""; + var unknownError = ""; + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, transactionFailedCallback); + if(dbconnection!==null){ + kony.db.transaction(dbconnection, transactionCallback, transactionFailedCallback, transactionSuccessCallback); + } + + function transactionCallback(tx){ + sync.log.trace("Entering kony.sync.getChunksFromDB->transactionCallback"); + var wcs = []; + wcs.push({key:kony.sync.metaTableScopeColumn, value:scopeName}); + wcs.push({key:kony.sync.chunkTablePayloadId, value:payloadId}); + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_where(query, wcs); + kony.sync.qb_select(query, null); + kony.sync.qb_orderBy(query, [{key:kony.sync.chunkTableChunkId, sortType:"asc"}]); + kony.sync.qb_from(query, kony.sync.chunkTableName); + + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(tx, sql, params); + if(resultset===false){ + isError = true; + return; + } + + if(resultset.rows.length !== chunkCount){ + //should never reach here + unknownError = "Unknown Error: Chunks in DB(" + resultset.rows.length + ") are not equal to chunkcount(" + chunkCount + ")"; + sync.log.error(unknownError); + isError = true; + return; + } + + for(var i=0; itransactionFailedCallback"); + callback(null, true, isError===true?1:2); + } + + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.getChunksFromDB->transactionSuccessCallback"); + if(isError){ + callback(unknownError, true); + } + else{ + callback(base64, false); + } + } +}; + +//clear chunking info from DB +kony.sync.clearChunkForPayload = function(payloadId, scopeName, chunkError, callback){ + sync.log.trace("Entering kony.sync.clearChunkForPayload"); + var isError = false; + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, transactionFailedCallback); + if(dbconnection!==null){ + kony.db.transaction(dbconnection, transactionCallback, transactionFailedCallback, transactionSuccessCallback); + } + function transactionCallback(tx){ + sync.log.trace("Entering kony.sync.clearChunkForPayload->transactionCallback"); + //set complete flag in metainfo table + var values = {}; + values[kony.sync.metaTableChunkAck] = kony.sync.chunkCompleteButNotAcknowledged; + + //if problem occurred while chunking, mark discard flag for next download + if(chunkError===true){ + values[kony.sync.metaTableChunkDiscarded] = kony.sync.chunkDiscarded; + } + var query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, values); + kony.sync.qb_update(query, kony.sync.chunkMetaTableName); + kony.sync.qb_where(query, [{key:kony.sync.metaTableScopeColumn, value:scopeName}]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + return; + } + + //clearing chunkdata from chunk table + var wcs = []; + wcs.push({key:kony.sync.metaTableScopeColumn, value:scopeName}); + wcs.push({key:kony.sync.chunkTablePayloadId, value:payloadId}); + + query = kony.sync.qb_createQuery(); + kony.sync.qb_where(query, wcs); + kony.sync.qb_delete(query, kony.sync.chunkTableName); + + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + return; + } + } + + function transactionFailedCallback(){ + sync.log.trace("Entering kony.sync.clearChunkForPayload->transactionFailedCallback"); + var errMsg = ""; + if(isError){ + errMsg = "Error occurred while clearing chunk information from " + kony.sync.chunkTableName; + callback({"errorCode":kony.sync.errorCodeSQLStatement, "errorMessage":errMsg}, true); + } + else{ + errMsg = "Error occurred while opening transaction for clearing chunk information from " + kony.sync.chunkTableName; + callback({"errorCode":kony.sync.errorCodeTransaction, "errorMessage":errMsg}, true); + } + sync.log.error(errMsg); + } + + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.clearChunkForPayload->transactionSuccessCallback"); + callback(null, false); + } +}; + +kony.sync.getChunkSize = function(){ + sync.log.trace("Entering kony.sync.getChunkSize"); + if(!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.chunkSizeKey])){ + return kony.sync.currentSyncConfigParams[kony.sync.chunkSizeKey]; + } +}; + +//This API checks whether chunking should be called before download or not +kony.sync.checkForChunkingBeforeDownload = function(serverblob, normalDownloadCallback, downloadNetworkCallback, schemaUpgradeServerblob){ + sync.log.trace("Entering kony.sync.checkForChunkingBeforeDownload"); + var scopeName = kony.sync.currentScope[kony.sync.scopeName]; + var isError = false; + var chunkingResumed = 0; + var lastsynctime = serverblob; + var chunkData = []; + var chunkMetaData = null; + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, transactionFailedCallback); + if(dbconnection!==null){ + kony.db.transaction(dbconnection, transactionCallback, transactionFailedCallback, transactionSuccessCallback); + } + function transactionCallback(tx){ + sync.log.trace("Entering kony.sync.checkForChunkingBeforeDownload->transactionCallback"); + var wcs = []; + wcs.push({key:kony.sync.metaTableScopeColumn, value:scopeName}); + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_where(query, wcs); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, kony.sync.chunkMetaTableName); + + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(tx, sql, params); + if(resultset===false){ + isError = true; + return; + } + + if(resultset.rows.length > 0){ + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + var pendingAck = rowItem[kony.sync.metaTableChunkAck]; + var chunkDiscarded = rowItem[kony.sync.metaTableChunkDiscarded]; + if(pendingAck === 0 && chunkDiscarded === 0){ + chunkingResumed = 1; //resume chunking + } + else{ + chunkingResumed = 2; //just send payloadid for acknowledgement + } + chunkMetaData = rowItem; //get meta data + + if(chunkingResumed===2 && pendingAck!==kony.sync.chunkCompleteAndWaitingForAck){ + //updating metadata status as sent for acknowledgement + var values = {}; + values[kony.sync.metaTableChunkAck] = kony.sync.chunkCompleteAndWaitingForAck; + query = kony.sync.qb_createQuery(); + kony.sync.qb_where(query, wcs); + kony.sync.qb_set(query, values); + kony.sync.qb_update(query, kony.sync.chunkMetaTableName); + + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + resultset = kony.sync.executeSql(tx, sql, params); + if(resultset===false){ + isError = true; + return; + } + } + + //get chunk ids for that payloadid + wcs = []; + wcs.push({key:kony.sync.metaTableScopeColumn, value:scopeName}); + wcs.push({key:kony.sync.chunkTablePayloadId, value:rowItem[kony.sync.metaTablePayloadId]}); + + query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, [kony.sync.chunkTableChunkId]); + kony.sync.qb_where(query, wcs); + kony.sync.qb_from(query, kony.sync.chunkTableName); + + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + resultset = kony.sync.executeSql(tx, sql, params); + if(resultset===false){ + isError = true; + return; + } + for(var i=0; itransactionSuccessCallback"); + if(chunkingResumed===1){ + //continue chunking from last point + var params = kony.sync.getChunkingParams(lastsynctime, schemaUpgradeServerblob); + var hashSum = chunkMetaData[kony.sync.metaTableChunkHashSum]; + var chunkCount = chunkMetaData[kony.sync.metaTableChunkCount]; + var payloadId = chunkMetaData[kony.sync.metaTablePayloadId]; + kony.sync.globalIsDownloadStarted = false; + kony.sync.downloadChunks(kony.sync.getChunkDownloadURL(), params, payloadId, chunkCount, hashSum, null, true, chunkData, downloadNetworkCallback); + } + else if(chunkingResumed===2){ + normalDownloadCallback(chunkMetaData[kony.sync.metaTablePayloadId]); + } + else{ + //proceed with normal download + normalDownloadCallback(); + } + } + + function transactionFailedCallback(){ + sync.log.trace("Entering kony.sync.checkForChunkingBeforeDownload->transactionFailedCallback"); + var errMsg = ""; + if(isError){ + errMsg = "Error occurred while inserting chunk information in metatable"; + downloadNetworkCallback(kony.sync.frameDownloadError(null,errMsg,1)); + } + else{ + errMsg = "Error occurred while opening transaction to store chunk information in metatable"; + downloadNetworkCallback(kony.sync.frameDownloadError(null,errMsg,2)); + } + sync.log.error(errMsg); + } +}; + +kony.sync.getChunkingParams = function(serverblob, schemaUpgradeServerblob) { + sync.log.trace("Entering kony.sync.getChunkingParams"); + //create params + if (kony.sync.isNullOrUndefined(serverblob)) { + serverblob = ""; + } + + var params = {}; + kony.sync.commonServiceParams(params); + + if(kony.sync.schemaUpgradeDownloadPending){ + params.tickcount = schemaUpgradeServerblob; + params.uppertickcount = serverblob; + if(!kony.sync.isNullOrUndefined(kony.sync.schemaUpgradeContext)){ + params.upgradecontext = kony.sync.schemaUpgradeContext; + } + } else { + params.tickcount = serverblob; + } + params.clientid = kony.sync.getDeviceID(); + + if(!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey])){ + params.httpconfig = {timeout:kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey]}; + } + + return params; +}; + +//API to abort all pending chunk requests +sync.cancelPendingChunkRequests = function(successcallback, errorcallback){ + sync.log.trace("Entering kony.sync.cancelPendingChunkRequests"); + if(!kony.sync.isSyncInitialized(errorcallback)){ + return; + } + var isError = false; + var dbname = kony.sync.scopes[0][kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, transactionFailedCallback); + if(dbconnection!==null){ + kony.db.transaction(dbconnection, transactionCallback, transactionFailedCallback, transactionSuccessCallback); + } + function transactionCallback(tx){ + sync.log.trace("Entering kony.sync.cancelPendingChunkRequests->transactionCallback"); + //change status in metatable to discarded + var values = {}; + values[kony.sync.metaTableChunkDiscarded] = kony.sync.chunkDiscarded; + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, values); + kony.sync.qb_update(query, kony.sync.chunkMetaTableName); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + } + + //delete pending chunks from chunk table + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, kony.sync.chunkTableName); + + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + return; + } + + } + + function transactionFailedCallback(){ + sync.log.trace("Entering kony.sync.cancelPendingChunkRequests->transactionFailedCallback"); + kony.sync.callTransactionError(errorcallback, isError); + } + + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.cancelPendingChunkRequests->transactionSuccessCallback"); + kony.sync.verifyAndCallClosure(successcallback); + } +}; + +//This will delete chunk data from metatable after receiving acknowledgement +kony.sync.clearChunkMetaData = function(tx, scopeName){ + sync.log.trace("Entering kony.sync.clearChunkMetaData"); + var wcs = []; + wcs.push({key:kony.sync.metaTableScopeColumn, value:scopeName}); + wcs.push({key:kony.sync.metaTableChunkAck, value:kony.sync.chunkCompleteAndWaitingForAck}); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_where(query, wcs); + kony.sync.qb_delete(query, kony.sync.chunkMetaTableName); + + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; + +kony.sync.callOnChunkStart = function(chunkCount, payloadId, scope, chunkid, chunkRequest){ + sync.log.trace("Entering kony.sync.callOnChunkStart"); + var params = {}; + params[kony.sync.chunkCountKey] = chunkCount; + params[kony.sync.payloadIdKey] = payloadId; + params[kony.sync.metaTableScopeColumn] = scope; + params[kony.sync.chunkTableChunkId] = chunkid; + params[kony.sync.chunkRequestKey] = chunkRequest; + + return kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onChunkStart], params); +}; + +kony.sync.callOnChunkSuccess = function(chunkCount, payloadId, scope, chunkid, pendingChunks, chunksDownloaded, serverParams){ + sync.log.trace("Entering kony.sync.callOnChunkSuccess"); + var params = {}; + params[kony.sync.chunkCountKey] = chunkCount; + params[kony.sync.payloadIdKey] = payloadId; + params[kony.sync.metaTableScopeColumn] = scope; + params[kony.sync.chunkTableChunkId] = chunkid; + params[kony.sync.pendingChunksKey] = pendingChunks; + params[kony.sync.chunksDownloadedKey] = chunksDownloaded; + params[kony.sync.serverDetails] = serverParams; + + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onChunkSuccess], params); +}; + +kony.sync.callOnChunkError = function(chunkCount, payloadId, scope, chunkid, pendingChunks, chunksDownloaded, errorCode, errorMsg, serverParams, errorInfo){ + sync.log.trace("Entering kony.sync.callOnChunkError"); + var params = {}; + params[kony.sync.chunkCountKey] = chunkCount; + params[kony.sync.payloadIdKey] = payloadId; + params[kony.sync.metaTableScopeColumn] = scope; + params[kony.sync.chunkTableChunkId] = chunkid; + params[kony.sync.pendingChunksKey] = pendingChunks; + params[kony.sync.chunksDownloadedKey] = chunksDownloaded; + params.errorCode = errorCode; + params.errorMessage = errorMsg; + params[kony.sync.serverDetails] = serverParams; + params.errorInfo = errorInfo; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onChunkError], params); +}; +// **************** End KonySyncChunkingHelper.js******************* + + +// **************** Start KonySyncDBOperations.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync)=== "undefined"){ + sync = {}; +} + +kony.sync.insert = function (tx, tablename, values, insert_callback, markForUpload) { + sync.log.trace("Entering kony.sync.insert "); + var scopename = kony.sync.scopes.syncTableScopeDic[tablename]; + if (markForUpload === false){ + values[kony.sync.mainTableChangeTypeColumn] = kony.sync.insertColStatusDI; + } else { + values[kony.sync.mainTableChangeTypeColumn] = kony.sync.insertColStatus; + } + values[kony.sync.mainTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + var scope = kony.sync.scopes[scopename]; + var generatedPK = kony.sync.replaceautogeneratedPK(scopename, scope.syncTableDic[tablename], values, tx, insert_callback); + if (generatedPK === false) { + return false; + } + //Check if it is original or save the original state. + + if (markForUpload === false) { + if (kony.sync.addToRollBack(tx, tablename, values, kony.sync.insertColStatusDI, null, insert_callback) === false) { + return false; + } + } else { + if (kony.sync.addToRollBack(tx, tablename, values, kony.sync.insertColStatus, null, insert_callback) === false) { + return false; + } + } + + if (kony.sync.insertEx(tx, tablename, values, insert_callback) === false) { + return false; + } + var syncorder = kony.sync.getSyncOrder(scopename, tx, insert_callback); + if (syncorder !== null && syncorder !== false) { + values[kony.sync.mainTableChangeTypeColumn] = null; + values[kony.sync.mainTableSyncVersionColumn] = null; + + if (markForUpload === false) { + values[kony.sync.historyTableChangeTypeColumn] = kony.sync.insertColStatusDI; + } else { + values[kony.sync.historyTableChangeTypeColumn] = kony.sync.insertColStatus; + } + values[kony.sync.historyTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + values[kony.sync.historyTableReplaySequenceColumn] = syncorder + 1; + + if (kony.sync.insertEx(tx, tablename + kony.sync.historyTableName, values, insert_callback) === false) { + return false; + } + + if (kony.sync.setSyncOrder(scopename, syncorder + 1, tx, insert_callback) === false) { + return false; + } + } else { + // not expected to come here + sync.log.fatal("Invalid sync order in insert function"); + } + return generatedPK; +}; + +kony.sync.insertEx = function (tx, tablename, values, errorcallback, rollback) { + sync.log.trace("Entering kony.sync.insertEx "); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, values); + kony.sync.qb_insert(query, tablename); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params, errorcallback, rollback); +}; + +kony.sync.purgeInsertEx = function (tx, tablename, values, rollback) { + sync.log.trace("Entering kony.sync.purgeInsertEx "); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_purgeInsert(query, tablename, values); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params, null, rollback); +}; + +kony.sync.error_callbackdb = function (error) { + sync.log.trace("Entering kony.sync.error_callbackdb "); + sync.log.error("@@@@@@@@@@@@@ -" + error.message + " @@@ " + error.code); +}; + +kony.sync.update = function (tx, tablename, values, wc, markForUpload) { + sync.log.trace("Entering kony.sync.update "); + //Check if it is original or save the original state. + + if (markForUpload === false) { + if(kony.sync.addToRollBack(tx, tablename, values, kony.sync.updateColStatusDU, wc)===false){ + return false; + } + } else { + if(kony.sync.addToRollBack(tx, tablename, values, kony.sync.updateColStatus, wc)===false){ + return false; + } + } + + var scopename = kony.sync.scopes.syncTableScopeDic[tablename]; + if (markForUpload === false) { + values[kony.sync.mainTableChangeTypeColumn] = kony.sync.updateColStatusDU; + } else { + values[kony.sync.mainTableChangeTypeColumn] = kony.sync.updateColStatus; + } + values[kony.sync.mainTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + + var resultSet = kony.sync.updateEx(tx, tablename, values, wc); + + var updateResult = {}; + if(resultSet===false){ + return false; + }else{ + updateResult[kony.sync.numberOfRowsUpdated] = resultSet.rowsAffected; + } + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + kony.sync.qb_where(query, wc); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + + var syncorder = kony.sync.getSyncOrder(scopename, tx); + if(syncorder === false){ + return false; + } + resultSet = kony.sync.executeSql(tx, sql, params); + if (resultSet === false) { + return false; + } + var record = kony.db.sqlResultsetRowItem(tx, resultSet, 0); + if(record === null){ + return false; + } + if (!kony.sync.isNullOrUndefined(syncorder)) { + record[kony.sync.historyTableReplaySequenceColumn] = syncorder + 1; + if (markForUpload === false) { + record[kony.sync.historyTableChangeTypeColumn] = kony.sync.updateColStatusDU; + } else { + record[kony.sync.historyTableChangeTypeColumn] = kony.sync.updateColStatus; + } + record[kony.sync.historyTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + if(kony.sync.addUpdateToHistoryTable(tx, tablename + kony.sync.historyTableName, record)===false){ + return false; + } + if(kony.sync.setSyncOrder(scopename, syncorder + 1, tx) === false) { + return false; + } + } else { + // not expected to come here + sync.log.fatal("Invalid sync order in insert function"); + } + return updateResult; +}; + +kony.sync.updateBatch = function (tx, tablename, values, wc, markForUpload, primaryKey) { + sync.log.trace("Entering kony.sync.updateBatch "); + //adding original values to rollback tables if exists + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0] + " " + wc; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params, null, null, "Adding original values to rollback tables if exists"); + var i = 0; + var record = null; + if (resultSet === false) { + return false; + } + var num_records = resultSet.rows.length; + for (i = 0; i < num_records; i++) { + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + if (markForUpload === false) { + record[kony.sync.originalTableChangeTypeColumn] = kony.sync.updateColStatusDU; + } else { + record[kony.sync.originalTableChangeTypeColumn] = kony.sync.updateColStatus; + } + record[kony.sync.originalTableSyncVersionColumn] = record[kony.sync.originalTableChangeTypeColumn]; + record[kony.sync.mainTableChangeTypeColumn] = null; + record[kony.sync.mainTableSyncVersionColumn] = null; + //record[kony.sync.mainTableHashSumColumn] = null; + kony.sync.insertEx(tx, tablename + kony.sync.originalTableName, record, null, false); + } + + //Get Primary Key from where clause + query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0] + " " + wc; + params = query_compile[1]; + resultSet = kony.sync.executeSql(tx, sql, params); + if (resultSet === false) { + return false; + } + num_records = resultSet.rows.length; + var pkSet = []; + for (i = 0; i < num_records; i++) { + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + var pkRecord = []; + for(var j in primaryKey){ + pkRecord.push({"key":primaryKey[j], "value":record[primaryKey[j]]}); + } + pkSet.push(pkRecord); + } + //updating main tables + var scopename = kony.sync.scopes.syncTableScopeDic[tablename]; + if (markForUpload === false) { + values[kony.sync.mainTableChangeTypeColumn] = kony.sync.updateColStatusDU; + } else { + values[kony.sync.mainTableChangeTypeColumn] = kony.sync.updateColStatus; + } + values[kony.sync.mainTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + // update the flag only if this record is present on server + resultSet = kony.sync.updateEx(tx, tablename, values, wc, null, true); + var updateResult = {}; + if(resultSet===false){ + return false; + }else{ + updateResult[kony.sync.numberOfRowsUpdated] = resultSet.rowsAffected; + //kony.sync.verifyAndCallClosure(update_callback, {kony.sync.numberOfRowsUpdated:resultSet.rowsAffected}); + } + var syncorder = kony.sync.getSyncOrder(scopename, tx); + if(syncorder === false){ + return false; + } + for(i in pkSet){ + query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + kony.sync.qb_where(query, pkSet[i]); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + resultSet = kony.sync.executeSql(tx, sql, params); + if (resultSet === false) { + return false; + } + record = kony.db.sqlResultsetRowItem(tx, resultSet, 0); + syncorder = syncorder + 1; + record[kony.sync.historyTableReplaySequenceColumn] = syncorder; + record[kony.sync.historyTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + if(kony.sync.addUpdateToHistoryTable(tx, tablename + kony.sync.historyTableName, record)===false){ + return false; + } + } + if(kony.sync.setSyncOrder(scopename, syncorder, tx)===false){ + return false; + } + return updateResult; +}; + + +kony.sync.updateEx = function (tx, tablename, values, wc, update_callback, isBatch) { + sync.log.trace("Entering kony.sync.updateEx "); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, values); + kony.sync.qb_update(query, tablename); + if(kony.sync.isNullOrUndefined(isBatch)) { + kony.sync.qb_where(query, wc); + } + //local sqlUpdate = "update "..tablename.." set "..updateStr..wc; + var query_compile = kony.sync.qb_compile(query); + var sqlUpdate = ""; + if (isBatch === true) { + sqlUpdate = query_compile[0] + " " + wc; + } else { + sqlUpdate = query_compile[0]; + } + var params = query_compile[1]; + + return kony.sync.executeSql(tx, sqlUpdate, params); + +}; + +kony.sync.upsertEx = function (tx, tablename, values, wc, callback) { + sync.log.trace("Entering kony.sync.upsertEx "); +//#ifdef android + //Check whether row exists or not + //OLD Implementation + if ((kony.sync.isrowexists(tx, tablename, wc, callback))) { + //Do an update + kony.sync.serverUpdateCount = kony.sync.serverUpdateCount + 1; + // update if the user hasn't changed the record + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] + 1; + kony.sync.updateEx(tx, tablename, values, wc); + } else { + //Do an Insert + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] + 1; + kony.sync.insertEx(tx, tablename, values, callback); + kony.sync.serverInsertCount = kony.sync.serverInsertCount + 1; + } +//#else + //#ifdef tabrcandroid + //Check whether row exists or not + //OLD Implementation + if ((kony.sync.isrowexists(tx, tablename, wc, callback))) { + //Do an update + kony.sync.serverUpdateCount = kony.sync.serverUpdateCount + 1; + // update if the user hasn't changed the record + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] + 1; + kony.sync.updateEx(tx, tablename, values, wc); + } else { + //Do an Insert + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] + 1; + kony.sync.insertEx(tx, tablename, values, callback); + kony.sync.serverInsertCount = kony.sync.serverInsertCount + 1; + } + //#else + var result = kony.sync.purgeInsertEx(tx, tablename, values, callback); + if (result !== false && result.rowsAffected === 0) { + kony.sync.serverUpdateCount = kony.sync.serverUpdateCount + 1; + // update if the user hasn't changed the record + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] + 1; + kony.sync.updateEx(tx, tablename, values, wc); + } else { + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] + 1; + kony.sync.serverInsertCount = kony.sync.serverInsertCount + 1; + } + //#endif +//#endif +}; + +kony.sync.isrowexists = function (tx, tablename, wc, errorCallback) { + sync.log.trace("Entering kony.sync.isrowexists "); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + kony.sync.qb_where(query, wc); + //local sql = "select * from "..tablename..wc; + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(tx, sql, params, errorCallback); + if (resultset === false) { + return false; + } + if (resultset.rows.length === 1) { + return true; + } else { + return null; //if row doesn't exists, we should add it to rollback table + } +}; + +//Function to delete one(batch)change +kony.sync.remove = function (tx, tablename, wc, isLocal, markForUpload, errorCallback) { + sync.log.trace("Entering kony.sync.remove "); + + //Check if it is original or save the original state. + if (isLocal !== true) { + if (markForUpload === false) { + if(kony.sync.addToRollBack(tx, tablename, null, kony.sync.deleteColStatusDD, wc, errorCallback) === false) { + return false; + } + } else { + if(kony.sync.addToRollBack(tx, tablename, null, kony.sync.deleteColStatus, wc, errorCallback) === false) { + return false; + } + } + } + + //Getting the records with the where clause + var scopename = kony.sync.scopes.syncTableScopeDic[tablename]; + var scope = kony.sync.scopes[scopename]; + var syncTable = scope.syncTableDic[tablename]; + var record = null; + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + kony.sync.qb_where(query, wc); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params, errorCallback); + if (resultSet === false) { + return false; + } + kony.sync.blobstore_delete(tx, tablename, wc, false); + var num_records = resultSet.rows.length; + var rowsDeleted = 0; + for (var i = 0; i < num_records; i++) { + //adding changes to history table + if(isLocal !== true) { + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + var values = []; + values[kony.sync.historyTableHashSumColumn] = record[kony.sync.mainTableHashSumColumn]; + if(!kony.sync.isNullOrUndefined(syncTable.Columns)){ + for (var j = 0; j < syncTable.Columns.length; j++) { + var column = syncTable.Columns[j]; + values[column.Name] = record[column.Name]; + } + } + var syncorder = kony.sync.getSyncOrder(scopename, tx, errorCallback); + if(syncorder === false){ + return false; + } + if (syncorder !== null) { + values[kony.sync.historyTableReplaySequenceColumn] = syncorder + 1; + if (markForUpload === false) { + values[kony.sync.historyTableChangeTypeColumn] = kony.sync.deleteColStatusDD; + } else { + values[kony.sync.historyTableChangeTypeColumn] = kony.sync.deleteColStatus; + } + values[kony.sync.historyTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + if(kony.sync.insertEx(tx, tablename + kony.sync.historyTableName, values, null, errorCallback) === false){ + return false; + } + if(kony.sync.setSyncOrder(scopename, syncorder + 1, tx, errorCallback) === false) { + return false; + } + } else { + // not expected to come here + sync.log.fatal("Invalid sync order in insert function"); + } + } else { + //deleting all local changes from history + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + sync.log.debug("Removing Local Changes: ", record); + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, null); + kony.sync.qb_from(query, tablename + kony.sync.historyTableName); + kony.sync.qb_where(query, wc); + query_compile = kony.sync.qb_compile(query); + params = query_compile[1]; + sql = query_compile[0]; + if(kony.sync.executeSql(tx, sql, params, errorCallback) === false){ + return false; + } + + //deleting all local changes from original + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + sync.log.debug("Removing Local Changes from original: ", record); + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, null); + kony.sync.qb_from(query, tablename + kony.sync.originalTableName); + kony.sync.qb_where(query, wc); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params, errorCallback) === false){ + return false; + } + } + //deleting from main table + var resultSet1 = kony.sync.removeEx(tx, tablename, wc, null , errorCallback); + if(resultSet1===false){ + return false; + } + rowsDeleted = rowsDeleted + resultSet1.rowsAffected; + } + var deleteResult = {}; + deleteResult[kony.sync.numberOfRowsDeleted] = rowsDeleted; + return deleteResult; +}; + +//Function to delete more than one(batch)changes +kony.sync.deleteBatch = function (tx, tablename, wc, isLocal, markForUpload, errorCallback) { + sync.log.trace("Entering kony.sync.deleteBatch "); + + var scopename = kony.sync.scopes.syncTableScopeDic[tablename]; + var i = null; + var record = null; + //adding original values to rollback tables if exists + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0] + " " + wc; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params, errorCallback); + if (resultSet === false) { + return false; + } + var num_records = resultSet.rows.length; + if (isLocal === false) { + for (i = 0; i <= num_records - 1; i++) { + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + record[kony.sync.originalTableChangeTypeColumn] = kony.sync.deleteColStatus; + record[kony.sync.originalTableSyncVersionColumn] = record[kony.sync.originalTableChangeTypeColumn]; + record[kony.sync.mainTableChangeTypeColumn] = null; + record[kony.sync.mainTableSyncVersionColumn] = null; + //record[kony.sync.mainTableHashSumColumn] = null; + kony.sync.insertEx(tx, tablename + kony.sync.originalTableName, record, null, false); + } + } + query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0] + " " + wc; + params = query_compile[1]; + var syncorder = kony.sync.getSyncOrder(scopename, tx, errorCallback); + if(syncorder === false){ + return false; + } + resultSet = kony.sync.executeSql(tx, sql, params, errorCallback); + if(resultSet === false){ + return false; + } + num_records = resultSet.rows.length; + if ((syncorder !== null)) { + for (i = 0; i < num_records; i++) { + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + //adding change replay to history tables + if (isLocal === false) { + syncorder = syncorder + 1; + record[kony.sync.historyTableReplaySequenceColumn] = syncorder; + if (markForUpload === false) { + record[kony.sync.historyTableChangeTypeColumn] = kony.sync.deleteColStatusDD; + } else { + record[kony.sync.historyTableChangeTypeColumn] = kony.sync.deleteColStatus; + } + record[kony.sync.historyTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + if(kony.sync.insertEx(tx, tablename + kony.sync.historyTableName, record, errorCallback)===false){ + return false; + } + } + //deleting local changes from history table + else { + sync.log.debug("Removing Local Changes: ", record); + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, null); + kony.sync.qb_from(query, tablename + kony.sync.historyTableName); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0] + " " + wc; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params, errorCallback)===false){ + return false; + } + sync.log.debug("Removing Local Changes from original: ", record); + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, null); + kony.sync.qb_from(query, tablename + kony.sync.originalTableName); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0] + " " + wc; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params, errorCallback) === false) { + return false; + } + } + } + if(kony.sync.setSyncOrder(scopename, syncorder, tx, errorCallback)===false){ + return false; + } + } else { + // not expected to come here + sync.log.fatal("Invalid sync order in insert function"); + } + //deleting main tables + resultSet = kony.sync.removeEx(tx, tablename, wc, true, errorCallback); + if(resultSet === false){ + return false; + } + var deleteResult = {}; + deleteResult[kony.sync.numberOfRowsDeleted] = resultSet.rowsAffected; + return deleteResult; +}; + + +kony.sync.removeEx = function (tx, tablename, wc, isBatch, errorcallback) { + sync.log.trace("Entering kony.sync.removeEx "); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, tablename); + if (kony.sync.isNullOrUndefined(isBatch)) { + kony.sync.qb_where(query, wc); + } + //local sql = "delete from "..tablename.." "..wc; + var query_compile = kony.sync.qb_compile(query); + var sql = ""; + if (isBatch === true) { + sql = query_compile[0] + " " + wc; + } else { + sql = query_compile[0]; + } + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params, errorcallback); +}; + +kony.sync.addToRollBack = function (tx, tablename, values, changetype, wcs, errorCallback) { + sync.log.trace("Entering kony.sync.addToRollBack "); + var originalwcs = kony.sync.CreateCopy(wcs); + var originalvalues = kony.sync.CreateCopy(values); + var rowExists = null; + if(changetype === kony.sync.insertColStatus || changetype === kony.sync.insertColStatusDI){ + originalvalues[kony.sync.originalTableChangeTypeColumn] = changetype; + originalvalues[kony.sync.originalTableSyncVersionColumn] = null; + originalvalues[kony.sync.mainTableChangeTypeColumn] = null; + originalvalues[kony.sync.mainTableSyncVersionColumn] = null; + originalvalues[kony.sync.mainTableHashSumColumn] = null; + + var scope = kony.sync.scopes[kony.sync.scopes.syncTableScopeDic[tablename]]; + var pkColumns = scope.syncTableDic[tablename].Pk_Columns; + var pkRecord = []; + for(var j in pkColumns){ + pkRecord.push({"key":pkColumns[j], "value":originalvalues[pkColumns[j]]}); + } + rowExists = kony.sync.isrowexists(tx, tablename + kony.sync.originalTableName, pkRecord); + if (rowExists === true) { + //Original State is already saved, no need to save again + return true; + } else if (rowExists === false) { + return false; + } else { + if (kony.sync.insertEx(tx, tablename + kony.sync.originalTableName, originalvalues) === false) { + return false; + } else { + return true; + } + } + + } + + rowExists = kony.sync.isrowexists(tx, tablename + kony.sync.originalTableName, wcs); + if (rowExists === true) { + //Original State is already saved, no need to save again + return true; + } else if (rowExists === false) { + return false; + } else if(rowExists === null){ + kony.table.insert(originalwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : "nil", + comptype : "OR", + openbrace : true + }); + kony.table.insert(originalwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : "-1", + comptype : "OR", + closebrace : true + }); + //table.insert(originalwcs,{key = kony.sync.mainTableChangeTypeColumn, value = "-1"}) + var record = kony.sync.getOriginalRow(tx, tablename, originalwcs, errorCallback); + if (record === false) { + return false; + } + /* This logic is not needed as when row is not already present in rollback table and + waiting for acknowledgement,it should not be backed up in original table because + rollbacking it would lead to inconsistency + Note: This case generally occurs in persistent strategy when record waits for acknowledgement + if (record === null) { + //means record got changed but pending for acknowledgement + kony.table.remove(originalwcs); + kony.table.insert(originalwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : "-1", + optype : "EQ", + comptype : "OR", + openbrace : true + }); + kony.table.insert(originalwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : changetype, + optype : "EQ", + comptype : "OR" + }); + kony.table.insert(originalwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : "90", + optype : "EQ", + comptype : "OR" + }); + kony.table.insert(originalwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : "91", + optype : "EQ", + closebrace : true + }); + record = kony.sync.getOriginalRow(tx, tablename, originalwcs, errorCallback); + if (record === false) { + return false; + } + } + */ + if (record !== null) { + //Records not equal to nil means that it is not pending to be uploaded/acknowledged. So original state has to saved. + record[kony.sync.originalTableChangeTypeColumn] = changetype; + record[kony.sync.originalTableSyncVersionColumn] = record[kony.sync.mainTableSyncVersionColumn]; + record[kony.sync.mainTableChangeTypeColumn] = null; + record[kony.sync.mainTableSyncVersionColumn] = null; + //record[kony.sync.mainTableHashSumColumn] = null; + record[kony.sync.mainTableHashSumColumn] = record[kony.sync.originalTableHashSumColumn]; + return kony.sync.insertEx(tx, tablename + kony.sync.originalTableName, record); + } + } +}; + +kony.sync.getOriginalRow = function (tx, tablename, wcs, errorcallback) { + sync.log.trace("Entering kony.sync.getOriginalRow "); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + kony.sync.qb_where(query, wcs); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(tx, sql, params, errorcallback); + if (!resultset) { + return false; + } + if (resultset.rows.length === 1) { + return kony.db.sqlResultsetRowItem(tx, resultset, 0); + } else { + return null; + } +}; + +kony.sync.syncDropDatabase = function (dbList, successcallback, errorcallback) { + sync.log.trace("Entering kony.sync.syncDropDatabase "); + sync.log.info("Dropping database list: ", dbList); + var isError = false; + + function single_transaction_success_callback(res) { + sync.log.trace("Entering single_transaction_success_callback"); + sync.log.debug("Single Select callback result: ", res); + if (!kony.sync.isNullOrUndefined(dbList) && !kony.sync.isNullOrUndefined(dbList[0]) && !kony.sync.isNullOrUndefined(dbList[0].dbname)){ + dbname = dbList[0].dbname; + //var connection1 = kony.db.openDatabaseSync(dbname, "1.0", dbname, 5 * 1024 * 1024); + //kony.db.transaction(connection1, single_transaction_callback, single_transaction_error_callback, single_transaction_success_callback); + var connection1 = kony.sync.getConnectionOnly(dbname, dbname); + kony.sync.startTransaction(connection1, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback); + } else { + sync.log.info("Deleting all binary files "); + if(typeof(sync.util) !== "undefined") { + sync.util.deleteallbinaryfiles(); + } + sync.log.info("Reinitializing..."); + sync.init(successcallback, errorcallback); + } + } + + function single_transaction_callback(tx) { + sync.log.trace("Entering single_transaction_callback"); + sync.log.info("Dropping database: ", dbList[0].dbname); + for (var i in dbList[0].tableList) { + var v = dbList[0].tableList[i]; + if(kony.sync.dropTable(tx, v)===false){ + isError = true; + return; + } + } + dbList = dbList.slice(1); + } + + function single_transaction_error_callback(res) { + sync.log.trace("Entering single_transaction_error_callback"); + sync.log.error("Sync Reset failed ", res); + //kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getSyncResetFailed()); + kony.sync.isResetInProgress = false; + kony.sync.callTransactionError(isError, errorcallback); + } + var dbname = dbList[0].dbname; + var connection = kony.sync.getConnectionOnly(dbname, dbname); + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback); +}; + +kony.sync.dropTable = function (tx, tablename) { + sync.log.trace("Entering kony.sync.dropTable "); + sync.log.info("Dropping tablename ", tablename); + var query = null; + if ((kony.sync.getBackEndDBType() === kony.sync.dbTypeSQLCE)) { + query = "Drop Table " + tablename; + } else if ((kony.sync.getBackEndDBType() === kony.sync.dbTypeSQLLite)) { + query = "Drop Table if exists " + tablename; + } + return kony.sync.executeSql(tx, query, null); +}; + +kony.sync.addUpdateToHistoryTable = function(tx, tablename, values){ + sync.log.trace("Entering kony.sync.addUpdateToHistoryTable "); + var toUpdate = false; + + if(!kony.sync.trackIntermediateUpdates){ + //frame primary key + var scope = kony.sync.scopes[kony.sync.scopes.syncTableScopeDic[tablename]]; + var pkColumns = scope.syncTableDic[tablename].Pk_Columns; + var wc = []; + if(!kony.sync.isNullOrUndefined(pkColumns )){ + for (var j = 0;j < pkColumns.length; j++){ + if(!kony.sync.isNullOrUndefined(values[pkColumns[j]])){ + kony.table.insert(wc, {key:pkColumns[j], value:values[pkColumns[j]]}); + } + } + } + //Get the row and check its changetype + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + kony.sync.qb_where(query, wc); + kony.sync.qb_orderBy(query, [{key:kony.sync.historyTableReplaySequenceColumn, sortType:"desc"}]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + var lastRecord = null; + var lastChangeType = null; + if(resultSet===false){ + return false; + } + if(resultSet.rows.length > 0){ + lastRecord = kony.db.sqlResultsetRowItem(tx, resultSet, 0); + lastChangeType = "" + lastRecord[kony.sync.historyTableChangeTypeColumn]; + if(lastChangeType === kony.sync.updateColStatus || lastChangeType === kony.sync.updateColStatusDU){ + toUpdate = true; + //update the last row + query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, values); + kony.sync.qb_update(query, tablename); + kony.table.insert(wc, {key:kony.sync.historyTableReplaySequenceColumn, value:lastRecord[kony.sync.historyTableReplaySequenceColumn]}); + kony.sync.qb_where(query, wc); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); + } + } + } + if(!toUpdate){ + var query1 = kony.sync.qb_createQuery(); + kony.sync.qb_set(query1, values); + kony.sync.qb_insert(query1, tablename); + var query_compile1 = kony.sync.qb_compile(query1); + var sql1 = query_compile1[0]; + var params1 = query_compile1[1]; + return kony.sync.executeSql(tx, sql1, params1); + } +}; +// **************** End KonySyncDBOperations.js******************* + + +// **************** Start KonySyncDownload.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync)=== "undefined"){ + sync = {}; +} + +kony.sync.syncDownloadChanges = function (sname, dbname, onCompletion){ + sync.log.trace("Entering kony.sync.syncDownloadChanges "); + kony.sync.onDownloadCompletion = onCompletion; + kony.sync.resetbatchsessionglobals(); + kony.sync.PersisChangestobeDeleted = []; //Used for upload after delete in persistence strategey + sync.log.info("Download started for scope : ", sname); + kony.sync.currentSyncScopeFilter = null; + if(kony.sync.isValidJSTable(kony.sync.currentSyncConfigParams[kony.sync.filterParams])){ + var scopeFilter = kony.sync.currentSyncConfigParams[kony.sync.filterParams][kony.sync.currentScope[kony.sync.scopeName]]; + sync.log.info("scope Filter for " + kony.sync.currentScope[kony.sync.scopeName] + " is :" + scopeFilter); + if (kony.sync.isNullOrUndefined(scopeFilter)) { + kony.sync.getLastSynctime(sname, dbname, kony.sync.syncDownloadchangesGetLastSynctime); + } else { + //current_sync_scopefilter_index = 0; + //kony.sync.syncDownloadbyFilter(current_sync_scopefilter_index); + kony.sync.syncDownloadbyFilter(); + } + } else { + kony.sync.getLastSynctime(sname, dbname, kony.sync.syncDownloadchangesGetLastSynctime); + } +}; + +//kony.sync.syncDownloadbyFilter = function (index) { +kony.sync.syncDownloadbyFilter = function () { + sync.log.trace("Entering kony.sync.syncDownloadbyFilter "); + var scopeFilter = kony.sync.currentSyncConfigParams[kony.sync.filterParams][kony.sync.currentScope[kony.sync.scopeName]]; + //if (index < scopeFilter.length) { + var scopejsonfilter = { + //"d" : scopeFilter[index] + "d" : scopeFilter + }; + var filtervaluejson = JSON.stringify(scopejsonfilter); + sync.log.debug(filtervaluejson); + kony.sync.currentSyncScopeFilter = scopeFilter; //scopeFilter[index]; + kony.sync.getLastSynctimeFilter(kony.sync.currentScope[kony.sync.scopeName], filtervaluejson, kony.sync.currentScope[kony.sync.scopeDataSource], kony.sync.syncDownloadchangesGetLastSynctime); + /*} else { + kony.sync.globalIsDownloadStarted = true; + kony.sync.onDownloadCompletion(false, null); + }*/ +}; + +kony.sync.syncDownloadchangesGetLastSynctime = function(rowItem) { + sync.log.trace("Entering kony.sync.syncDownloadchangesGetLastSynctime "); + var lastsynctime = rowItem[0][kony.sync.metaTableSyncTimeColumn]; + sync.log.info("Last Sync Time with Server : " + lastsynctime); + var upgradeSchemaLastSyncTime = rowItem[0][kony.sync.metaTableSchemaUpgradeSyncTimeColumn]; + var serverChanges = null; + var startTime = new Date(); + var isError = false; + + if(kony.sync.schemaUpgradeDownloadPending && kony.sync.isSchemaUpgradeTimeStampEmpty(lastsynctime)){ + sync.log.trace("Skipping download for schema upgrade as no data available"); + kony.sync.onDownloadCompletion(false); + return; + } + + function downloadNextBatch(tx) { + sync.log.trace("Entering downloadNextBatch"); + var morechanges = serverChanges.d.__sync.moreChangesAvailable; + var serverblob = serverChanges.d.__sync.serverblob; + var pendingbatches = serverChanges.d.__sync.pendingBatches; + kony.sync.currentSyncReturnParams[kony.sync.lastSyncTimestamp] = serverblob; + if(kony.sync.isApplyChangesSync()){ + if(kony.sync.applyChanges(tx, kony.sync.currentScope, serverChanges)===false){ + isError = true; + return; + } + if(kony.sync.postApplyChanges(tx,serverblob, morechanges, pendingbatches)===false){ + isError = true; + return; + } + }else{ + kony.sync.applyChangesAsync(tx, kony.sync.currentScope, serverChanges, serverblob, morechanges); + } + } + + function downloadCompleted() { + sync.log.trace("Entering downloadCompleted"); + if(kony.sync.globalIsDownloadStarted){ + //This means that download has failed and variable is reset; + return; + } + var endTime = new Date(); + var diff = endTime.getTime() - startTime.getTime(); + sync.log.debug("Time Taken for Batch Insertion Download : " + diff); + kony.sync.batchInsertionTimer = kony.sync.batchInsertionTimer + diff; + var params = {}; + params.pending_batches = kony.sync.tonumber(kony.sync.syncPendingBatchesNo); + params.serverinsertcount = "Server Insert Count :" + kony.sync.serverInsertCount; + params.serverupdatecount = "Server Update Count :" + kony.sync.serverUpdateCount; + params.serverinsertackcount = "Server Insert Ack Count :" + kony.sync.serverInsertAckCount; + params.serverupdateackcount = "Server Update Ack Count :" + kony.sync.serverUpdateAckCount; + sync.log.debug("@@@@@@" + params); + kony.table.insert(kony.sync.currentSyncLog, params); + var batchcontext = {}; + sync.log.debug(kony.sync.serverInsertCount); + batchcontext[kony.sync.numberOfRowsDownloaded] = kony.sync.serverInsertCount + kony.sync.serverUpdateCount + kony.sync.serverDeleteCount; + batchcontext[kony.sync.numberOfRowsInserted] = kony.sync.serverInsertCount; + batchcontext[kony.sync.numberOfRowsUpdated] = kony.sync.serverUpdateCount; + batchcontext[kony.sync.numberOfRowsDeleted] = kony.sync.serverDeleteCount; + batchcontext[kony.sync.numberOfRowsFailedtoUpload] = kony.sync.serverFailedCount; + batchcontext[kony.sync.failedRowInfo] = kony.sync.uploadSummary; + batchcontext[kony.sync.objectLevelInfo] = kony.sync.objectLevelInfoMap; + + kony.sync.objectLevelInfoMap = {}; + if ((kony.sync.currentScope[kony.sync.syncStrategy] !== kony.sync.syncStrategy_OTA)) { + batchcontext[kony.sync.numberOfRowsAcknowledged] = kony.sync.serverInsertAckCount + kony.sync.serverUpdateAckCount + kony.sync.serverDeleteAckCount; + batchcontext[kony.sync.numberOfRowsInsertedAck] = kony.sync.serverInsertAckCount; + batchcontext[kony.sync.numberOfRowsUpdatedAck] = kony.sync.serverUpdateAckCount; + batchcontext[kony.sync.numberOfRowsDeletedAck] = kony.sync.serverDeleteAckCount; + } + batchcontext[kony.sync.pendingBatches] = kony.sync.tonumber(kony.sync.syncPendingBatchesNo); + kony.sync.currentSyncReturnParams[kony.sync.batchContext] = batchcontext; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onBatchProcessingSuccess], kony.sync.currentSyncReturnParams); + if ((kony.sync.moreChangesAvailable)) { + kony.sync.syncDownloadChanges(kony.sync.currentScope[kony.sync.scopeName], kony.sync.currentScope[kony.sync.scopeDataSource], kony.sync.onDownloadCompletion); + } else { + kony.sync.printScopeLog(kony.sync.currentSyncLog); + delete kony.sync.currentSyncReturnParams[kony.sync.batchContext]; + + //clearing sync order and then deleting records after upload + if (kony.sync.isUploadErrorPolicyCOE(kony.sync.currentScope)) { + if(kony.sync.currentScope[kony.sync.syncStrategy] !== kony.sync.syncStrategy_OTA ) { + removeAfterUpload(0); + } else { + kony.sync.updateSyncOrderForScope(removeAfterUpload); + } + } else { + removeAfterUpload(0); + } + } + } + + //wrapper for removeafterupload + function removeAfterUpload(code) { + sync.log.trace("Entering removeAfterUpload"); + if(code===0){ + kony.sync.deleteRecordsAfterUpload(postDownloadProcessing); + }else{ + //statement error + if(code===kony.sync.errorCodeSQLStatement){ + kony.sync.downloadFailed(true); + } + //transaction error + else{ + kony.sync.downloadFailed(false); + } + } + } + + //This function should be called after finishing all post download tasks like removeafterupload + function postDownloadProcessing(code) { + sync.log.trace("Entering postDownloadProcessing"); + if(code===0){ + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onDownloadSuccess], kony.sync.currentSyncReturnParams); + /*if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncScopeFilter)) { + kony.sync.syncDownloadbyFilter(kony.sync.currentSyncScopeFilterIndex + 1); + } else {*/ + kony.sync.globalIsDownloadStarted = true; + kony.sync.onDownloadCompletion(false, null); + //} + } + else{ + //statement error + if(code===kony.sync.errorCodeSQLStatement){ + kony.sync.downloadFailed(true); + } + //transaction error + else{ + kony.sync.downloadFailed(false); + } + } + } + + //Used for upload after delete in persistence strategey , Adding all the merged records in delete queue + function recsToBeDeletedAfterUploadForPersistentStrategy(serverChanges) { + var scopename = kony.sync.currentScope[kony.sync.scopeName]; + if(!kony.sync.isNullOrUndefined(serverChanges.d) && !kony.sync.isNullOrUndefined(serverChanges.d.results)){ + for(var i in serverChanges.d.results){ + var tablename = serverChanges.d.results[i].__metadata.type; + if(kony.sync.checkForDeleteAfterUpload(tablename,scopename) === true + && !kony.sync.isNullOrUndefined(serverChanges.d.results[i][kony.sync.mergedWithEIS]) + && serverChanges.d.results[i][kony.sync.mergedWithEIS] === "1") { + kony.sync.PersisChangestobeDeleted.push(serverChanges.d.results[i]); + } + } + sync.log.info("Changes to be deleted after upload", kony.sync.PersisChangestobeDeleted); + } + } + function downloadcallback(serverChangesResult) { + sync.log.trace("Entering downloadcallback"); + var endTime = new Date(); + var diff = endTime.getTime() - startTime.getTime(); + sync.log.debug("Time Taken for Network Batch Download : " + diff); + kony.sync.batchDownloadTimer = kony.sync.batchDownloadTimer + diff; + serverChanges = serverChangesResult; + + sync.log.info("ServerChanges:", serverChanges); + if(!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.removeAfterUpload]) + && kony.sync.currentScope[kony.sync.syncStrategy] !== kony.sync.syncStrategy_OTA ) { + recsToBeDeletedAfterUploadForPersistentStrategy(serverChanges); + } + if (!kony.sync.isNullOrUndefined(serverChanges.opstatus) && serverChanges.opstatus !== 0) { + kony.sync.globalIsDownloadStarted = true; + if (!kony.sync.isNullOrUndefined(serverChanges.d)) { + kony.sync.onDownloadCompletion(true, kony.sync.getServerError(serverChanges.d, "download")); + } else { + kony.sync.onDownloadCompletion(true, kony.sync.getServerError(serverChanges)); + } + return; + }else if(kony.sync.isNullOrUndefined(serverChanges.d)){ + kony.sync.onDownloadCompletion(true, kony.sync.getServerError(serverChanges)); + return; + } + kony.sync.currentSyncReturnParams[kony.sync.serverDetails] = {}; + kony.sync.currentSyncReturnParams[kony.sync.serverDetails][kony.sync.hostName] = kony.sync.getServerDetailsHostName(serverChanges); + kony.sync.currentSyncReturnParams[kony.sync.serverDetails][kony.sync.ipAddress] = kony.sync.getServerDetailsIpAddress(serverChanges); + if ((serverChanges.d.error === "true")) { + kony.sync.globalIsDownloadStarted = true; + var hasResults = serverChanges.d.hasOwnProperty("results"); + if(hasResults && (serverChanges.d["results"].length > 0)) { + applyDownloadBatchChangesToDBonError(); + } else { + kony.sync.onDownloadCompletion(true, kony.sync.getServerError(serverChanges.d, "download")); + } + return; + } + //If has uploadErrors for persistentSync incase of AbortOnError Sync Strategy + if(hasUploadErrors(serverChanges)) { + kony.sync.globalIsDownloadStarted = true; + var hasResults = serverChanges.d.hasOwnProperty("results"); + if(hasResults && (serverChanges.d["results"].length > 0)) { + applyDownloadBatchChangesToDBonError(); + //Update Sync Order for failed records + updateVersionNumberOnPersistentDownload(); + } else { + var uploadErrorsInfoMap = getUploadErrorsInfoMap(serverChanges); + //Update Sync Order for failed records + updateVersionNumberOnPersistentDownload(); + kony.sync.onDownloadCompletion(true, uploadErrorsInfoMap); + } + return; + } + + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, kony.sync.syncFailed); + if(dbconnection===null){ + return; + } + if(kony.sync.isApplyChangesSync()){ + kony.db.transaction(dbconnection, downloadNextBatch, downloadNextBatchFailed, downloadCompleted); + }else{ + kony.db.transaction(dbconnection, downloadNextBatch, downloadNextBatchFailed, downloadCompleted,{isCommitTransaction:false}); + } + } + + function hasUploadErrors(serverChanges) { + if( !kony.sync.isNullOrUndefined(serverChanges) && !kony.sync.isNullOrUndefined(serverChanges.d) && (serverChanges.d.error === "false") + && !kony.sync.isNullOrUndefined(serverChanges.d.__sync) && !kony.sync.isNullOrUndefined(serverChanges.d.__sync.UploadErrors)) { + return true; + } + return false; + } + + function getUploadErrorsInfoMap(serverChanges) { + var failedRowsInfoMap = {}; + if( kony.sync.isNullOrUndefined(serverChanges) || kony.sync.isNullOrUndefined(serverChanges.d) || + kony.sync.isNullOrUndefined(serverChanges.d.__sync) || kony.sync.isNullOrUndefined(serverChanges.d.__sync.UploadErrors)) { + return failedRowsInfoMap; + } + var errors = serverChanges.d.__sync.UploadErrors; + var failedRowsInfo = []; + var errorMap = null; + var serverDetails = {}; + for(var i=0; i< errors.length; i++) { + errorMap = errors[i]; + for(var key in errorMap) { + var contextMap = errorMap[key]; + failedRowsInfo.push( { + key:contextMap.primaryKeys, + type:contextMap.type, + errorMessage:contextMap.errorMessage + }); + } + } + failedRowsInfoMap[kony.sync.failedRowInfo] = failedRowsInfo; + if (!kony.sync.isNullOrUndefined(serverChanges.d.server)) { + serverDetails[kony.sync.hostName] = serverChanges.d.server.hostName; + serverDetails[kony.sync.ipAddress] = serverChanges.d.server.ipAddress; + } + failedRowsInfoMap[kony.sync.serverDetails] = serverDetails; + return failedRowsInfoMap; + } + + function updateVersionNumberOnPersistentDownload() { + sync.log.trace("Entering updateVersionNumberOnPersistentDownload "); + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var scopename = kony.sync.currentScope[kony.sync.scopeName]; + var sql = null; + var params = null; + var query = null; + var query_compile = null; + kony.sync.getConnection(dbname, dbname, transactionCallback, successCallback, failureCallback); + + function transactionCallback(tx) { + var versionNo = kony.sync.getseqnumber(tx, scopename); + if (!kony.sync.isNullOrUndefined(kony.sync.currentScope.ScopeTables)) { + for (var i = 0; i < kony.sync.currentScope.ScopeTables.length; i++) { + var syncTable = kony.sync.currentScope.ScopeTables[i]; + if (kony.sync.isNullOrUndefined(syncTable)) { + continue; + } + var tbname = syncTable.Name; + query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tbname + kony.sync.historyTableName); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + if (resultSet !== false) { + var num_records = resultSet.rows.length; + if (num_records > 0) { + var versionMap = {}; + versionMap[kony.sync.historyTableSyncVersionColumn] = versionNo.versionnumber; + var whereClause = []; + kony.table.insert(whereClause, { + key: kony.sync.historyTableChangeTypeColumn, + value: "9%", + optype: "NOT LIKE" + }); + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tbname + kony.sync.historyTableName); + kony.sync.qb_set(query, versionMap); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if (kony.sync.executeSql(tx, sql, params) === false) { + return; + } + } + } else { + return; + } + } + } + } + + function failureCallback() { + sync.log.error(" Failed to update version number for failed rows on persistent download "); + } + + function successCallback() { + sync.log.trace(" Updated version number for failed rows on persistent download "); + } + } + + function applyDownloadBatchChangesToDBonError() { + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, kony.sync.syncFailed); + if(dbconnection===null){ + return; + } + if(kony.sync.globalIsDownloadStarted) { + if(kony.sync.isApplyChangesSync()) { + if(hasUploadErrors(serverChanges)) { + kony.db.transaction(dbconnection, downloadNextBatch, currentBatchDownloadError, kony.sync.onDownloadCompletion(true, getUploadErrorsInfoMap(serverChanges))); + }else { + kony.db.transaction(dbconnection, downloadNextBatch, currentBatchDownloadError, kony.sync.onDownloadCompletion(true, kony.sync.getServerError(serverChanges.d, "download"))); + } + } else { + if(hasUploadErrors(serverChanges)) { + kony.db.transaction(dbconnection, downloadNextBatch, currentBatchDownloadError, kony.sync.onDownloadCompletion(true, getUploadErrorsInfoMap(serverChanges)),{isCommitTransaction:false}); + } else { + kony.db.transaction(dbconnection, downloadNextBatch, currentBatchDownloadError, kony.sync.onDownloadCompletion(true, kony.sync.getServerError(serverChanges.d, "download")),{isCommitTransaction:false}); + } + } + } + } + + function currentBatchDownloadError() { + var serverError = null; + if(!kony.sync.isNullOrUndefined(serverChanges.d)) { + serverError = kony.sync.getServerError(serverChanges.d, "download"); + } + var errorTable = kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null); + if(serverError === null) { + kony.sync.onDownloadCompletion(true, errorTable); + return; + } + if(serverError && serverError.errorMessage && errorTable && errorTable.errorMessage) { + serverError.errorMessage = serverError.errorMessage + " and " + errorTable.errorMessage; + } + kony.sync.onDownloadCompletion(true, serverError); + } + + function downloadNextBatchFailed(){ + sync.log.trace("Entering downloadNextBatchFailed"); + kony.sync.downloadFailed(isError); + } + + function scopeSettingsCallback(isInitialized) { + sync.log.trace("Entering scopeSettingsCallback"); + kony.sync.konyDownloadChanges(lastsynctime, null, downloadcallback, isInitialized, upgradeSchemaLastSyncTime); + } + kony.sync.isScopeInitialized(kony.sync.currentScope[kony.sync.scopeName], kony.sync.currentScope[kony.sync.scopeDataSource], scopeSettingsCallback); +}; + +kony.sync.downloadFailed = function (dbError) { + sync.log.trace("Entering kony.sync.downloadFailed "); + kony.sync.gSyncFailed = true; + kony.sync.globalIsDownloadStarted = true; + //kony.sync.onDownloadCompletion(true, JSON.stringify(connection)); + sync.log.error("Scope Download Failed"); + if (!dbError) { + kony.sync.onDownloadCompletion(true, kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } + else{ + kony.sync.onDownloadCompletion(true, kony.sync.errorObject); + kony.sync.errorObject = null; + } +}; + + +kony.sync.applyChanges = function (tx, currentScope, serverChanges) { + sync.log.trace("Entering kony.sync.applyChanges "); + sync.log.info("Applying Changes from Server................... ----------->"); + var results = serverChanges.d.results; + if (!kony.sync.isNullOrUndefined(results)) { + return kony.sync.applyChangesToDB({ + "tx" : tx, + "currentScope" : currentScope, + "results" : results, + "startposition" : 0, + "endposition" : results.length + }); + } +}; + +kony.sync.postApplyChanges = function (tx, serverblob, moreChangesAvailable, pendingBatches) { + sync.log.trace("Entering kony.sync.postApplyChanges "); + if(kony.sync.clearChunkMetaData(tx, kony.sync.currentScope[kony.sync.scopeName])===false){ + return false; + } + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncScopeFilter)) { + var scopejsonfilter = { + "d" : kony.sync.currentSyncScopeFilter + }; + var filtervaluejson = JSON.stringify(scopejsonfilter); + if(kony.sync.setLastSyncTimeFilter(tx, kony.sync.currentScope[kony.sync.scopeName], filtervaluejson, null, serverblob)===false){ + return false; + } + } else { + if(kony.sync.setLastSyncTime(tx, kony.sync.currentScope[kony.sync.scopeName], null, serverblob)===false){ + return false; + } + } + //shrink memory execution + kony.db.executeSql(tx, "PRAGMA shrink_memory"); + if (!kony.sync.isNullOrUndefined(moreChangesAvailable)) { + var temp = moreChangesAvailable; + temp = temp + ""; + temp = temp.toLowerCase(); + if ((temp === "true")) { + //Enable below code if PendingBatches is implemented. + if (!kony.sync.isNullOrUndefined(pendingBatches)) { + kony.sync.syncPendingBatchesNo = pendingBatches; + } + kony.sync.moreChangesAvailable = true; + } else { + kony.sync.moreChangesAvailable = false; + kony.sync.syncPendingBatchesNo = 0; + } + } else { + kony.sync.moreChangesAvailable = false; + } + sync.log.info("more changes available " + kony.sync.moreChangesAvailable); + if (!kony.sync.moreChangesAvailable) { + //After Every successful Scope download completion we will check and update the Scope Settings to make that scope Initialized; + if(kony.sync.updateScopeSettings(tx, kony.sync.currentScope[kony.sync.scopeName])===false){ + return false; + } + //After Every successful Scope download completion we will check if this download was for schema upgrade and mark it complete + if(kony.sync.setSchemaUpgradeDownloadComplete(tx, kony.sync.currentScope[kony.sync.scopeName])===false){ + return false; + } + } +}; + +kony.sync.applyChangesAsync = function (tx, currentScope, serverChanges, serverblob, morechanges) { + sync.log.trace("Entering kony.sync.applyChangesAsync "); + sync.log.info("Applying Changes from Server................... ----------->"); + var results = serverChanges.d.results; + var bbBatchSize = kony.sync.getAsyncDownloadBatchSize(); + var lastbatch = results.length % bbBatchSize; + var noofloops = (results.length - lastbatch) / bbBatchSize; + + var context = { + "tx" : tx, + counter : 0, + "currentScope" : currentScope, + "results" : results, + "noofloops" : noofloops, + "lastbatch" : lastbatch, + "serverblob" : serverblob, + "morechanges" : morechanges + }; + sync.log.debug("sending context"); + kony.api.executeAsync(kony.sync.applyChangesToDBAsync, context); +}; + +kony.sync.applyChangesToDBAsync = function (context) { + sync.log.trace("Entering kony.sync.applyChangesToDBAsync "); + sync.log.debug("point ******b : ", context); + if (context.counter >= context.noofloops) { + if (context.lastbatch > 0) { + context.startposition = context.counter * kony.sync.getAsyncDownloadBatchSize(); + context.endposition = context.startposition + context.lastbatch; + kony.sync.applyChangesToDB(context); + context.counter = context.counter + 1; + context.lastbatch = 0; + kony.api.executeAsync(kony.sync.applyChangesToDBAsync, context); + } else { + kony.sync.postApplyChanges(context.tx, context.serverblob, context.morechanges); + kony.db.commitTransaction(context.tx); + } + + } else { + context.startposition = context.counter * kony.sync.getAsyncDownloadBatchSize(); + context.endposition = context.startposition + kony.sync.getAsyncDownloadBatchSize(); + kony.sync.applyChangesToDB(context); + context.counter = context.counter + 1; + sync.log.debug("point ******c : ", context); + kony.api.executeAsync(kony.sync.applyChangesToDBAsync, context); + } +}; + +kony.sync.updateSyncVerisonNumberForFailedRow = function (tx, tablename, pkKey, pkValue) { + sync.log.trace("Entering kony.sync.updateSyncVerisonNumberForFailedRow "); + var versionNo = kony.sync.getseqnumber(tx, kony.sync.currentScope[kony.sync.scopeName]); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename + kony.sync.historyTableName); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + if (resultSet !== false) { + if(resultSet.rows.length > 0) { + var versionMap = {}; + versionMap[kony.sync.historyTableSyncVersionColumn] = versionNo.versionnumber; + var whereClause = []; + kony.table.insert(whereClause, { + key: kony.sync.historyTableChangeTypeColumn, + value: "9%", + optype: "NOT LIKE" + }); + kony.table.insert(whereClause, { + key:pkKey, + value:pkValue + }); + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename + kony.sync.historyTableName); + kony.sync.qb_set(query, versionMap); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if (kony.sync.executeSql(tx, sql, params) === false) { + return; + } + } + } +} + +kony.sync.applyChangesToBlobStoreDB = function(tx, tablename, row, binaryColumns, changeType) { + var binaryColumnsLength = binaryColumns.length; + var binaryColumnName = null; + var blobIndex = null; + var konysyncBinaryField = null; + var query = null; + var query_compile = null; + var sql = null; + var params = null; + var resultset = null; + for(var i=0; i 0) { + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + if (!kony.sync.isNullOrUndefined(rowItem[konysyncBinaryField])) { + blobIndex = rowItem[konysyncBinaryField]; + if(changeType !== "delete") { + var isUpdateSuccessful = kony.sync.blobManager.updateBlob(tx, blobIndex, row[binaryColumnName], + function(err){ + kony.sync.errorObject = err; + kony.sync.downloadFailed(false); + return; + }); + if(!isUpdateSuccessful) { + kony.sync.downloadFailed(false); + } + }else { + var isDeleteSuccessful = kony.sync.blobManager.deleteBlob(tx, blobIndex, function(err){ + kony.sync.errorObject = err; + kony.sync.downloadFailed(false); + return; + }); + if(!isDeleteSuccessful) { + kony.sync.downloadFailed(false); + } + } + } + } + //insert binary value + else { + var downloadPolicy = kony.sync.getDownloadPolicy(tablename, binaryColumnName); + if(downloadPolicy === kony.sync.inline) { + blobIndex = kony.sync.blobManager.saveBlob(tx, tablename, binaryColumnName, row[binaryColumnName], + function (err) { + kony.sync.downloadFailed(false); + } + ); + } + } + //in case of ondemand download, blobindex will not be disturbed. + // So insert the url payload as-is. + if(!kony.sync.isNullOrUndefined(blobIndex)) { + delete row[binaryColumnName]; + row[konysyncBinaryField] = blobIndex; + } + } + } +}; + +kony.sync.applyChangesToDB = function (context) { + sync.log.trace("Entering kony.sync.applyChangesToDB "); + var tx = context.tx; + var results = context.results; + var startposition = context.startposition; + var endposition = context.endposition; + var newVersion = kony.sync.getseqnumber(tx, kony.sync.currentScope.ScopeName); + var newVersionNo = newVersion.versionnumber; + var j = null; + var pk = null; + var query_compile = null; + var query = null; + var sql = null; + var params = null; + var resultset = null; + if(kony.sync.isNullOrUndefined(results)){ + return; + } + for (var i = startposition; i < endposition; i++) { + var row = results[i]; + var tablename = row.__metadata.type; + + if (kony.sync.isNullOrUndefined(kony.sync.objectLevelInfoMap[tablename])) { + kony.sync.objectLevelInfoMap[tablename] = {}; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDownloaded] = 0; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] = 0; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] = 0; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDeleted] = 0; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInsertedAck] = 0; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdatedAck] = 0; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDeletedAck] = 0; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsAcknowledged] = 0; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsFailedtoUpload] = 0; + } + + if (kony.sync.objectLevelInfoMap[tablename][kony.sync.reconciledKeysKey] == null){ + kony.sync.objectLevelInfoMap[tablename][kony.sync.reconciledKeysKey] = []; + } + var changeType = row.__metadata.changeType; + var values = []; + var pkColumns = kony.sync.currentScope.syncTableDic[tablename].Pk_Columns; + var pkwcs = []; + var pkset = null; + var pksetwcs = []; + //var currentversion = kony.sync.getCurrentVersionNumber(tablename); + var MergedWithEIS = row[kony.sync.mergedWithEIS]; + var versionNumber = row[kony.sync.mainTableSyncVersionColumn]; + versionNumber = kony.sync.tonumber(versionNumber); + if(MergedWithEIS !== "1" && MergedWithEIS !== "0") { + if(!kony.sync.isNullOrUndefined(kony.sync.scopes.syncScopeBlobInfoMap[tablename])){ + var binaryDataColumns = kony.sync.scopes.syncScopeBlobInfoMap[tablename][kony.sync.columns]; + kony.sync.applyChangesToBlobStoreDB(tx, tablename, row, binaryDataColumns, changeType); + } + } + if (kony.sync.isNullOrUndefined(kony.sync.queryStore[tablename + "purgeInsert"])) { + values = kony.sync.removeprovisioncolumns(row, kony.sync.currentScope.syncTableDic[tablename].Columns, true); + } else { + values = kony.sync.removeprovisioncolumns(row, kony.sync.currentScope.syncTableDic[tablename].Columns, false); + } + if (MergedWithEIS !== "1" && MergedWithEIS !== "0") { + if ((changeType === "update")) { + //do purge logic here. + var result = null; + //#ifdef KONYSYNC_ANDROID + result = kony.sync.purgeInsertEx(tx, tablename, values, false); + if (result === false) + //#else + result = kony.sync.purgeInsertEx(tx, tablename, values, true); + if (result === false){ + return false; + } + if (result !== false && result.rowsAffected === 0) + //#endif + { + var _upgradeContext = kony.sync.schemaUpgradeContext; + var _upgradeContextJSON = null; + if(!kony.sync.isNullOrUndefined(_upgradeContext)){ + _upgradeContextJSON = JSON.parse(_upgradeContext); + } + //add the null columns update scenario + if(kony.sync.isNullOrUndefined(_upgradeContextJSON) || kony.sync.isNullOrUndefined(_upgradeContextJSON[tablename])) + values = kony.sync.removeprovisioncolumns(row, kony.sync.currentScope.syncTableDic[tablename].Columns, true, false); + else//DSC scenario + values = kony.sync.removeprovisioncolumns(row, kony.sync.currentScope.syncTableDic[tablename].Columns, true, true); + + if(!kony.sync.isNullOrUndefined(pkColumns)){ + for (j = 0; j < pkColumns.length; j++) { + pk = pkColumns[j]; + if (!kony.sync.isNullOrUndefined(row[kony.sync.clientPKPrefix + pk])) { + //pkset = pkset.." "..pk.."='"..row[pk].."'"; + if (kony.sync.isNullOrUndefined(pkset)) { + pkset = []; + } + kony.table.insert(pkwcs, { + key : pk, + value : row[kony.sync.clientPKPrefix + pk] + }); + pkset[pk] = row[pk]; + kony.table.insert(pksetwcs, { + key : pk, + value : row[pk] + }); + } else { + kony.table.insert(pkwcs, { + key : pk, + value : row[pk] + }); + kony.table.insert(pksetwcs, { + key : pk, + value : row[pk] + }); + } + } + } + kony.table.insert(pkwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : "nil", + optype : "EQ", + comptype : "OR", + openbrace : true + }); + kony.table.insert(pkwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : -1, + optype : "EQ", + comptype : "OR", + closebrace : true + }); + /* kony.table.insert(pkwcs, { + key: kony.sync.mainTableSyncVersionColumn, + value: currentversion, + optype : "EQ" + });*/ + var originalwcs = kony.sync.CreateCopy(pksetwcs); + var hasInstanceInHistoryTable = kony.sync.checkForHistoryInstance(tx, tablename, values, originalwcs); + if( hasInstanceInHistoryTable === 0 ) { + return false; + } + + if(hasInstanceInHistoryTable === false) { + if (!kony.sync.isNullOrUndefined(pkset)) { + if(kony.sync.updateEx(tx, tablename, values, pksetwcs)===false){ + return false; + } + } else { + if(kony.sync.updateEx(tx, tablename, values, pkwcs)===false){ + return false; + } + } + } + + kony.sync.serverUpdateCount = kony.sync.serverUpdateCount + 1; + // update if the user hasn't changed the record + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] + 1; +// if(kony.sync.updateEx(tx, tablename, values, pkwcs)===false){ +// return false; +// } + } else { + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] + 1; + kony.sync.serverInsertCount = kony.sync.serverInsertCount + 1; + } + } + else if ((changeType === "delete")) { + values = kony.sync.removeprovisioncolumns(row, kony.sync.currentScope.syncTableDic[tablename].Columns, true, true); + // delete the record if it hasn't been changed by the user + if(!kony.sync.isNullOrUndefined(pkColumns)){ + for (j = 0; j < pkColumns.length; j++) { + pk = pkColumns[j]; + if (!kony.sync.isNullOrUndefined(row[kony.sync.clientPKPrefix + pk])) { + //pkwc = pkwc.." "..pk.."='"..row["Client_"..pk].."'"; + //pkset = pkset.." "..pk.."='"..row[pk].."'"; + if (kony.sync.isNullOrUndefined(pkset)) { + pkset = []; + } + kony.table.insert(pkwcs, { + key : pk, + value : row[kony.sync.clientPKPrefix + pk] + }); + pkset[pk] = row[pk]; + kony.table.insert(pksetwcs, { + key : pk, + value : row[pk] + }); + } else { + kony.table.insert(pkwcs, { + key : pk, + value : row[pk] + }); + } + } + } + kony.table.insert(pkwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : "nil", + optype : "EQ", + comptype : "OR", + openbrace : true + }); + kony.table.insert(pkwcs, { + key : kony.sync.mainTableChangeTypeColumn, + value : -1, + optype : "EQ", + closebrace : true + }); + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDeleted] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDeleted] + 1; + kony.sync.serverDeleteCount = kony.sync.serverDeleteCount + 1; + /*WARNING: Undefined method call for kony.sync.deleteEx*/ + if(kony.sync.removeEx(tx, tablename, pkwcs)===false){ + return false; + } + } + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDownloaded] = + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInserted] + + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdated] + + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDeleted]; + } else { + if(!kony.sync.isNullOrUndefined(kony.sync.scopes.syncScopeBlobInfoMap[tablename])){ + var binaryDataColumns = kony.sync.scopes.syncScopeBlobInfoMap[tablename][kony.sync.columns]; + var binaryColumn = null; + for(var k=0; k= 1 ){ + var rowItem =kony.db.sqlResultsetRowItem(tx,resultset,0); + for(var j=0;j 0) { + kony.sync.updateEx(tx, tablename, values, whereClause); + } else { + query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, values); + kony.sync.qb_insert(query, tablename); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + //exit incase of SQL error + return false; + } + } + } + else{ + //exit incase of SQL error + return false; + } + } + continue; + } + + if (!kony.sync.isNullOrUndefined(pkset)) { + /* clear dirty flag if not updated again*/ + kony.table.insert(pksetwcs, { + key: kony.sync.mainTableSyncVersionColumn, + value: versionNumber, + optype : "LT_EQ", + openbrace : true, + comptype:"OR" + }); + kony.table.insert(pksetwcs, { + key: kony.sync.mainTableSyncVersionColumn, + value: "nil", + closebrace : true + }); + + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, pksetwcs); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + return false; + } + } else { + kony.table.insert(pkwcs, { + key: kony.sync.mainTableSyncVersionColumn, + value: versionNumber, + optype : "LT_EQ", + openbrace : true, + comptype :"OR" + }); + kony.table.insert(pkwcs, { + key: kony.sync.mainTableSyncVersionColumn, + value: "nil", + closebrace : true + }); + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, pkwcs); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + return false; + } + } + if (changeType === "update") { + // clear the dirty flag + values[kony.sync.mainTableChangeTypeColumn] = "nil"; + values[kony.sync.mainTableSyncVersionColumn] = "nil"; + var hasInstanceInHistoryTable = kony.sync.checkForHistoryInstance(tx, tablename, values, originalwcs); + if(hasInstanceInHistoryTable === 0){ + return false; + } + if(hasInstanceInHistoryTable === false){ + if (!kony.sync.isNullOrUndefined(pkset)) { + if(kony.sync.updateEx(tx, tablename, values, pksetwcs)===false){ + return false; + } + } else { + if(kony.sync.updateEx(tx, tablename, values, pkwcs)===false){ + return false; + } + } + } + } else if(changeType === "delete"){ + if(!kony.sync.isNullOrUndefined(pkset)) { + kony.table.insert(pksetwcs, { + key: kony.sync.mainTableSyncVersionColumn, + value: versionNumber + }); + if(kony.sync.removeEx(tx, tablename, pksetwcs)===false){ + return false; + } + } else { + kony.table.insert(pkwcs, { + key: kony.sync.mainTableSyncVersionColumn, + value: versionNumber + }); + if(kony.sync.removeEx(tx, tablename, pkwcs)===false){ + return false; + } + } + } + } + } +}; + +kony.sync.reconcileForeignKeyForChildren = function(tx,pksetwcs,pkwcs,tablename,parentRow,currentIndex,endposition,results){ + //populate setClause and whereClause for the child tables + function populateMetaDataForReconciliation(_pkColumns,_row,_pkset,_pkwcs){ + if(!kony.sync.isNullOrUndefined(_pkColumns)){ + for (var j = 0; j < _pkColumns.length; j++) { + var pk = _pkColumns[j]; + if (!kony.sync.isNullOrUndefined(_row[kony.sync.clientPKPrefix + pk])) { + kony.table.insert(_pkwcs, { + key : pk, + value : _row[kony.sync.clientPKPrefix + pk] + }); + _pkset[pk] = _row[pk]; + } + } + } + } + + //get the childrow + var childRowFound = false; + for(var j = currentIndex+1; j < endposition;j++){ + + var childPkwcs = []; + var childPkset = []; + + var childRow = results[j]; + var childMetaData = childRow.__metadata; + var childTablename = childMetaData.type; + var childPkColumns = kony.sync.currentScope.syncTableDic[childTablename].Pk_Columns; + var parentAttributes = []; + var childAttributes = []; + + //Forward Relationships(OneToMany) reconcilation + var OneToMany = kony.sync.currentScope.syncTableDic[tablename].Relationships.OneToMany; + if(!kony.sync.isNullOrUndefined(OneToMany)){ + for(var k in OneToMany) { + if(OneToMany[k].TargetObject === childTablename){ + var currentRelation = OneToMany[k]; + //relation found add the SourceObject_Attributes and TargetObject_Attributes to corresponding arrays + var relationshipAttributes = currentRelation.RelationshipAttributes; + for(var l = 0;l", err); + } +}; + +kony.sync.verifyAndCallClosure = function (closure, params) { + sync.log.trace("Entering kony.sync.verifyAndCallClosure "); + if (kony.sync.isValidFunctionType(closure)) { + return closure(params); + } else { + sync.log.warn("Invalid callback type : ", closure); + } +}; + +kony.sync.getArrayCount = function (tab) { + sync.log.trace("Entering kony.sync.getArrayCount "); + var count = 0; + if (!kony.sync.isNullOrUndefined(tab)) { + for (var i in tab) { + count = count + 1; + } + } + return count; +}; + +kony.sync.getDeviceID = function () { + sync.log.trace("Entering kony.sync.getDeviceID"); + if(kony.sync.deviceId !== ""){ + return kony.sync.deviceId; + } + //#ifdef KONYSYNC_IOS + var deviceInfo = kony.os.deviceInfo(); + if(deviceInfo.osversion < 7){ + return deviceInfo.deviceid; + }else{ + if(kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.deviceIdentifierIOS7Key])){ + return deviceInfo.identifierForVendor; + }else{ + return kony.sync.currentSyncConfigParams[kony.sync.deviceIdentifierIOS7Key]; + } + } + //#else + return kony.os.deviceInfo().deviceid; + //#endif +}; + +kony.sync.getInstanceID = function () { + sync.log.trace("Entering kony.sync.getInstanceID "); + return kony.sync.instanceId; +}; + +kony.sync.getOriginalDeviceID = function () { + sync.log.trace("Entering kony.sync.getOriginalDeviceID "); + if (kony.sync.isNullOrUndefined(kony.sync.originalDeviceId)) { + kony.sync.originalDeviceId = kony.os.deviceInfo().deviceid; + return kony.os.deviceInfo().deviceid; + } else { + return kony.sync.originalDeviceId; + } +}; + +kony.sync.removeprovisioncolumns = function (row, columns, isArray, isUpdate) { + sync.log.trace("Entering kony.sync.removeprovisioncolumns "); + var length = columns.length; + var record = []; + var i = null; + if (!isArray) { + for (i = length - 1; i >= 0; i--) { + if (!kony.sync.isNullOrUndefined(row[columns[i].Name])){ + record.push(row[columns[i].Name]); + } + else if(isUpdate !== true){ + record.push("NULL"); + } + } + if (!kony.sync.isNullOrUndefined(row.konysynchashsum)) { + record.push(row.konysynchashsum); + } + return record; + } else { + for (i = length - 1; i >= 0; i--) { + if (!kony.sync.isNullOrUndefined(row[columns[i].Name])){ + record[columns[i].Name] = row[columns[i].Name]; + } + else if(isUpdate !== true){ + record[columns[i].Name] = "NULL"; + } + } + if(!kony.sync.isNullOrUndefined(row.konysynchashsum)) { + record.konysynchashsum = row.konysynchashsum; + } + return record; + } +}; + +kony.sync.replaceautogeneratedPK = function (sname, synctable, values, tx, errorCallback) { + sync.log.trace("Entering kony.sync.replaceautogeneratedPK "); + var id = null; + var pkTab = {}; + if(!kony.sync.isNullOrUndefined(synctable.Pk_Columns)){ + for (var i = 0; i < synctable.Pk_Columns.length; i++){ + var pk = synctable.Pk_Columns[i]; + if (synctable.ColumnsDic[pk].Autogenerated === "true") { + id = kony.sync.getLastGeneratedID(sname, tx, errorCallback); + if (id === false) { + return false; + } + id = id - 1; + if (synctable.ColumnsDic[pk].type === "string") { + id = id.toString(); + } + values[pk] = id; + pkTab[pk] = id; + if (!kony.sync.setLastGeneratedID(sname, id, tx, errorCallback)) { + return false; + } + } else { + pkTab[pk] = values[pk]; + } + } + } + //implemented for composite primary key + return pkTab; +}; + +kony.sync.CreateCopy = function (tab) { + sync.log.trace("Entering kony.sync.CreateCopy "); + if (kony.sync.isNullOrUndefined(tab)){ + return null; + } + var copy = []; + for (var key in tab) { + var value = tab[key]; + if (kony.sync.isValidJSTable(value)) { + copy[key] = kony.sync.CreateCopy(tab[key]); + } else { + copy[key] = tab[key]; + } + } + return copy; +}; + +kony.sync.getautogeneratePK = function (sname, synctable) { + sync.log.trace("Entering kony.sync.getautogeneratePK "); + var agPKs = []; + if(!kony.sync.isNullOrUndefined(synctable.Pk_Columns)){ + for (var i = 0; i < synctable.Pk_Columns.length; i++) { + var pk = synctable.Pk_Columns[i]; + if ((synctable.ColumnsDic[pk].Autogenerated === "true")) { + kony.table.insert(agPKs, pk); + } + } + } + return agPKs; +}; + +kony.sync.getDBNamefromDataSource = function (dsname) { + sync.log.trace("Entering kony.sync.getDBNamefromDataSource "); + + sync.log.debug("validatint dsname : ",dsname); + for (var i in konysyncClientSyncConfig.ArrayOfDataSource) { + var datasource = konysyncClientSyncConfig.ArrayOfDataSource[i]; + + sync.log.debug("datasource.type:" + datasource.type + ":datasource.ID:" + datasource.ID); + if ((datasource.type === "database" && datasource.ID === dsname)) { + return datasource.Database.DatabaseName; + } + } + return null; +}; + +kony.sync.getAppId = function () { + sync.log.trace("Entering kony.sync.getAppId "); + return kony.sync.currentSyncConfigParams.appid; +}; + +kony.sync.getBatchSize = function () { + sync.log.trace("Entering kony.sync.getBatchSize "); + if(!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams.batchsize)) { + return kony.sync.currentSyncConfigParams.batchsize; + } + if (kony.os.deviceInfo().name === "blackberry") { + return "50"; + } else { + return "500"; + } +}; + +kony.sync.resetsyncsessionglobals = function (opName) { + sync.log.trace("Entering kony.sync.resetsyncsessionglobals "); + kony.sync.currentScope = null; + kony.sync.currentSyncReturnParams = {}; + kony.sync.isSyncStopped = false; + if(opName==="startSession"){ + kony.sync.currentSyncReturnParams[kony.sync.uploadURL] = kony.sync.getUploadURL(); + kony.sync.currentSyncReturnParams[kony.sync.downloadURL] = kony.sync.getDownloadURL(); + } + kony.sync.currentSyncLog = []; +}; + +kony.sync.resetscopesessionglobals = function (CallBack) { + var isError = false; + function clearSchemaUpgradeContext(tx){ + //resetting the schemaupgrade flag once the download of the columns is done in memory and in db + kony.sync.schemaUpgradeContext = null; + var sql = "update " + kony.sync.syncConfigurationTableName + " set " + + kony.sync.syncConfigurationColumnSchemaUpgradeContext + " = null"; + if (kony.sync.executeSql(tx, sql, null) === false) { + isError = true; + return;//error + } + sync.log.info("schemaupgrade context cleared successfully in memory and db"); + } + function clearSchemaSuccessCallBack(){ + CallBack(true); + } + function dbErrorCallBack(errInfo){ + sync.log.error("error in opening db connection " +JSON.stringify(errInfo)); + clearSchemaErrorCallBack(errInfo); + } + function clearSchemaErrorCallBack(errInfo){ + sync.log.error("failed to clear schemaupgradeinfo in synconfigtable after dsc " +JSON.stringify(errInfo)); + kony.sync.isErrorInAnyScope = true; + CallBack(true); + } + + sync.log.trace("Entering kony.sync.resetscopesessionglobals "); + kony.sync.syncPendingBatchesNo = 0; + delete kony.sync.currentSyncReturnParams[kony.sync.batchContext]; + delete kony.sync.currentSyncReturnParams[kony.sync.uploadContext]; + if(kony.sync.currentScope === null) { + kony.sync.currentScope = kony.sync.scopes[0]; //- Start 1st Scope Sync + CallBack(false); + }else{ + sync.log.debug("Scope index: ", kony.sync.currentScope.Index); + sync.log.debug("Scope count: ", kony.sync.scopes.scopecount); + if (kony.sync.currentScope.Index === kony.sync.scopes.scopecount - 1) { + if(!kony.sync.isNullOrUndefined(kony.sync.schemaUpgradeContext)){ + var dbName = kony.sync.currentScope[kony.sync.scopeDataSource]; + var conn = kony.sync.getConnectionOnly(dbName,dbName,dbErrorCallBack); + if(conn !== null){ + kony.db.transaction(conn, clearSchemaUpgradeContext,clearSchemaErrorCallBack,clearSchemaSuccessCallBack); + } + } + else + CallBack(true);//Sync Complete + } + else{ + kony.sync.currentScope = kony.sync.scopes[kony.sync.currentScope.Index + 1]; //Get Next Scope + CallBack(false); + } + } + +}; + +kony.sync.resetuploadsessioglobals = function () { + sync.log.trace("Entering kony.sync.resetuploadsessioglobals "); + delete kony.sync.currentSyncReturnParams[kony.sync.uploadContext]; + delete kony.sync.currentSyncReturnParams[kony.sync.lastSyncTimestamp]; + delete kony.sync.currentSyncReturnParams[kony.sync.uploadSequenceNumber]; + //sync_total_inserts = 0; + kony.sync.syncTotalInserts = 0; + kony.sync.syncTotalUpdates = 0; + kony.sync.syncTotalDeletes = 0; + kony.sync.serverInsertCount = 0; + kony.sync.serverUpdateCount = 0; + kony.sync.serverDeleteCount = 0; + kony.sync.serverInsertAckCount = 0; + kony.sync.serverUpdateAckCount = 0; + kony.sync.serverDeleteAckCount = 0; + kony.sync.serverFailedCount = 0; + kony.sync.uploadSummary = []; +}; + +kony.sync.resetbatchsessionglobals = function () { + sync.log.trace("Entering kony.sync.resetbatchsessionglobals "); + delete kony.sync.currentSyncReturnParams[kony.sync.batchContext]; + delete kony.sync.currentSyncReturnParams[kony.sync.uploadContext]; + delete kony.sync.currentSyncReturnParams[kony.sync.uploadSequenceNumber]; + kony.sync.serverInsertCount = 0; + kony.sync.serverUpdateCount = 0; + kony.sync.serverDeleteCount = 0; + kony.sync.serverInsertAckCount = 0; + kony.sync.serverUpdateAckCount = 0; + kony.sync.serverDeleteAckCount = 0; + kony.sync.serverFailedCount = 0; + kony.sync.uploadSummary = []; + kony.sync.objectLevelInfoMap = {}; +}; + +kony.sync.getSyncTable = function (tablename) { + sync.log.trace("Entering kony.sync.getSyncTable "); + var scopename = kony.sync.scopes.syncTableScopeDic[tablename]; + return kony.sync.scopes[scopename].syncTableDic[tablename]; +}; + +kony.sync.getCurrentVersionNumber = function (tbname) { + sync.log.trace("Entering kony.sync.getCurrentVersionNumber "); + var scopename = kony.sync.scopes.syncTableScopeDic[tbname]; + return kony.sync.currentSyncScopesState[scopename]; +}; + +kony.sync.getBackEndDBType = function () { + sync.log.trace("Entering kony.sync.getBackEndDBType "); + if (kony.sync.platformName === null) { + kony.sync.platformName = kony.os.deviceInfo().name; + } + if (kony.sync.platformName === "winmobile") { + return kony.sync.dbTypeSQLCE; + } + return kony.sync.dbTypeSQLLite; +}; + +kony.sync.printScopeLog = function () { + sync.log.trace("Entering kony.sync.printScopeLog "); + sync.log.info("Sync complete"); + sync.log.info("----------------------------------------------------"); + for (var i = 0; i < kony.sync.currentSyncLog.length; i++) { + var batch = kony.sync.currentSyncLog[i]; + sync.log.info("Batch No: ", i); + sync.log.info("Batch log: ", batch); + } + sync.log.info("----------------------------------------------------"); +}; + +//To generate hash +kony.sync.genHash = function (hashType, plaintext) { + sync.log.trace("Entering kony.sync.genHash "); + //return same in case of null/undefined plaintext + if (kony.sync.isNull(plaintext)) { + return plaintext; + } + + //if hashType is callback, get the value from it + if(kony.sync.isValidFunctionType(hashType)){ + return hashType(plaintext); + } + + //convert plaintext to string if not already + plaintext = plaintext.toString(); + + //apply default value in case of invalid/null/undefined hashtype + if (kony.sync.isNull(hashType) || kony.string.equalsIgnoreCase(kony.type(hashType), "string")===false) { + return kony.crypto.createHash("sha256", plaintext); + } + //return same if hashtype is none + else if(kony.string.equalsIgnoreCase(hashType, "none")===true){ + return plaintext; + } + //apply the desired hash algo + else{ + return kony.crypto.createHash(hashType, plaintext); + } +}; + +kony.sync.tonumber = function(arg) { + sync.log.trace("Entering kony.sync.tonumber "); + if(kony.sync.isNullOrUndefined(arg)) { + return null; + } + + //duplicating kony.os.toNumber in order to avoid Android platform dependency issues + if (arguments.length !== 1) { + throw new Error("Invalid argument to os.toNumber"); + } + + if (typeof(arg) === "number") { + return arg; + } else if (typeof(arg) === "string") { + + var str = arg.replace(/^\s*/, '').replace(/\s*$/, ''); + if (str === '') { + return null; + } else { + var num = str - 0; + return (isNaN(num) ? null : num); + } + + } else { + return null; + } +}; + +kony.sync.filterNullsFromSelectResult = function(res){ + sync.log.trace("Entering kony.sync.filterNullsFromSelectResult "); + if(kony.sync.enableORMValidations){ + var tableToMap = [ ]; + for (var j in res){ + var u = res[j]; + var rowToMap = {}; + for(var k in u){ + var v = u[k]; + if(!kony.sync.isNull(v)){ + rowToMap[k] = v; + } + } + kony.table.insert(tableToMap, rowToMap); + } + return tableToMap; + } + else{ + return res; + } +}; +kony.sync.getAsyncDownloadBatchSize = function () { + sync.log.trace("Entering kony.sync.getAsyncDownloadBatchSize "); + if(!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams.asyncbatchsize)){ + return kony.sync.currentSyncConfigParams.asyncbatchsize; + } + return 50; +}; + +kony.sync.isApplyChangesSync = function () { + sync.log.trace("Entering kony.sync.isApplyChangesSync "); + var returnVal; + //#ifdef bb + returnVal = false; + //#else + returnVal = true; + //#endif + return returnVal; +}; + +kony.sync.getChangeTypeForUploadTrue = function(type) { + sync.log.debug("ValueSentForChange: ", type); + if(typeof(type) === "number"){ + type = type.toString(); + } + if (type === "90") { + return "0"; + } + if (type === "91") { + return "1"; + } + if (type === "92") { + return "2"; + } + return type; +}; + +//Checking whether table is defined for delete after upload or not +kony.sync.checkForDeleteAfterUpload = function (tablename, scopename) { + sync.log.trace("Entering kony.sync.checkForDeleteAfterUpload "); + var i = null; + var myTab = kony.sync.currentSyncConfigParams[kony.sync.removeAfterUpload]; + if(kony.sync.isNullOrUndefined(myTab)){ + return false; + } + if(!kony.sync.isNullOrUndefined(scopename)){ + if(kony.sync.isNullOrUndefined(myTab[scopename])){ + return false; + } + if (myTab[scopename].length === 0){ + return true; + } + for (i in myTab[scopename]){ + if(myTab[scopename][i] === tablename){ + return true; + } + } + } else { + for(i in myTab) { + for (var j in myTab[i]) { + if (myTab[i][j] === tablename) { + return true; + } + } + } + } + return false; +}; + +//checking for false updates +kony.sync.checkForFalseUpdate = function (dbname, tbname, twcs, markForUpload, errorcallback, successcallback) { + sync.log.trace("Entering kony.sync.checkForFalseUpdate "); + var uploadstatus = true; + var isError = false; + if(markForUpload === false){ + return true; + } else { + kony.table.insert(twcs, { + key : kony.sync.historyTableChangeTypeColumn, + value : "90", + optype : "EQ", + comptype : "AND" + }); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, [kony.sync.historyTableChangeTypeColumn]); + kony.sync.qb_from(query, tbname + "_history"); + kony.sync.qb_where(query, twcs); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var connection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback, "check for false update"); + if(connection !== null){ + kony.sync.startTransaction(connection, transaction_callback, update_successcallback, single_transaction_error_callback, "check for false update"); + } + } + + function transaction_callback(tx) { + sync.log.trace("Entering kony.sync.checkForFalseUpdate transaction_callback"); + var resultSet = kony.sync.executeSql(tx, sql, params, errorcallback); + if (resultSet !== false) { + var num_records = resultSet.rows.length; + if (num_records !== 0) { + sync.log.error("Record does not exist on server, mark it for upload before updating/deleting it"); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeMarkForUpload, kony.sync.getErrorMessage(kony.sync.errorCodeMarkForUpload), null)); + uploadstatus = false; + } else { + uploadstatus = true; + } + } else { + //return; + isError = true; + } + + } + function update_successcallback() { + sync.log.trace("Entering kony.sync.checkForFalseUpdate update_successcallback"); + if (!isError && uploadstatus === true) { + successcallback(); + } + } + + function single_transaction_error_callback() { + sync.log.error("Entering kony.sync.checkForFalseUpdate single_transaction_error_callback"); + if (!isError) { + sync.log.error("Transaction error occurred", "check for false update"); + kony.sync.showTransactionError(errorcallback, "check for false update"); + }else{ + sync.log.error("Transaction error occurred", kony.sync.errorObject); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } +}; + +kony.sync.checkForFalseUpdateWCS = function (dbname, tbname, twcs, markForUpload, errorcallback, successcallback) { + sync.log.trace("Entering kony.sync.checkForFalseUpdateWCS "); + var uploadstatus = true; + var isError = false; + if (markForUpload === false) { + return true; + } + if(twcs !== "" && !kony.sync.isNull(twcs)){ + twcs = twcs + " AND " + kony.sync.historyTableChangeTypeColumn + " = 90"; + } + else{ + twcs = " where " + kony.sync.historyTableChangeTypeColumn + " = 90"; + } + var sql = "select " + kony.sync.historyTableChangeTypeColumn + " from " + tbname + "_history " + twcs; + var connection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback, "check for false update WCS"); + if(connection !== null){ + kony.sync.startTransaction(connection, transaction_callback, update_successcallback, update_failurecallback, "check for false update WCS"); + } + function transaction_callback(tx) { + sync.log.trace("Entering kony.sync.checkForFalseUpdateWCS transaction_callback"); + var resultSet = kony.sync.executeSql(tx, sql, null, errorcallback); + if (resultSet !== false){ + var num_records = resultSet.rows.length; + if (num_records !== 0){ + sync.log.error("Record does not exist on server, mark it for upload before updating/deleting it"); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeMarkForUpload, kony.sync.getErrorMessage(kony.sync.errorCodeMarkForUpload), null)); + uploadstatus = false; + } else { + uploadstatus = true; + } + } else { + isError = true; + } + } + function update_successcallback() { + sync.log.trace("Entering kony.sync.checkForFalseUpdateWCS update_successcallback"); + if (!isError && uploadstatus === true) { + successcallback(); + } + } + function update_failurecallback() { + sync.log.trace("Entering kony.sync.checkForFalseUpdateWCS update_failurecallback"); + if (!isError && uploadstatus === true){ + sync.log.error("Transaction error occurred : ", "check for false update WCS"); + kony.sync.showTransactionError(errorcallback,"check for false update WCS"); + }else{ + sync.log.error("Transaction error occurred : ", kony.sync.errorObject); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } +}; + +kony.sync.getConnection = function (dbName, displayName, transactionCallBack, successCallBack, errorCallBack) { + sync.log.trace("Entering kony.sync.getConnection "); + var connection = kony.sync.getConnectionOnly(dbName, displayName, errorCallBack); + if(connection!==null){ + kony.db.transaction(connection, transactionCallBack, errorCallBack, successCallBack); + } +}; + +//This function starts a transaction given a connection +kony.sync.startTransaction = function (connection, transactionCallBack, successCallBack, errorCallBack) { + sync.log.trace("Entering kony.sync.startTransaction "); + kony.db.transaction(connection, transactionCallBack, errorCallBack, successCallBack); +}; + +kony.sync.showTransactionError = function (errorCallBack, moduleName){ + sync.log.trace("Entering kony.sync.showTransactionError "); + if(kony.sync.isNullOrUndefined(moduleName)){ + moduleName = ""; + } + sync.log.fatal(moduleName + ":" + " Db connection is null"); + kony.sync.verifyAndCallClosure(errorCallBack, kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); +}; + +kony.sync.checkIntegrity = function (dbname, rMap, successCallback, errorCallBack) { + sync.log.trace("Entering kony.sync.checkIntegrity "); + if(!kony.sync.enableORMValidations){ + kony.sync.verifyAndCallClosure(successCallback); + return; + } + var status = true; + var isError = false; + var integrityFailedMap = null; + var connection = kony.sync.getConnectionOnly(dbname, dbname, errorCallBack, "Checking integrity"); + if(connection !== null){ + kony.sync.startTransaction(connection, integrityTransaction, integritySuccess, integrityFailure, "Checking Referential Integrity Constraints"); + } + function integrityTransaction(tx) { + integrityFailedMap = kony.sync.checkIntegrityinTransaction(tx,rMap); + } + function integritySuccess() { + var error = ""; + if (integrityFailedMap === true) { + kony.sync.verifyAndCallClosure(successCallback); + } + else{ + for(var key in integrityFailedMap){ + error = error + integrityFailedMap[key]; + } + kony.sync.verifyAndCallClosure(errorCallBack, kony.sync.getErrorTable(kony.sync.errorCodeReferentialIntegrity, error)); + } + } + function integrityFailure() { + if (!integrityFailedMap) { + kony.sync.showTransactionError(errorCallBack,"Checking integrity"); + }else{ + kony.sync.verifyAndCallClosure(errorCallBack, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } +}; + +kony.sync.checkIntegrityinTransaction_old = function (tx, rMap) { + sync.log.trace("Entering kony.sync.checkIntegrityinTransaction "); + var integrityFailedMap = {}; + if(!kony.sync.enableORMValidations){ + return true; + } + + for(var obj in rMap){ + for (var key in rMap[obj]) { + if (kony.sync.isNull(rMap[obj][key].targetAttributeValue)) { + continue; + } + if(integrityFailedMap[rMap[obj][key].foreignKeyAttribute] === false){ + continue; + } + if(rMap[obj][key].targetAttributeValue === ""){ + rMap[obj][key].targetAttributeValue = "''"; + } + var sql = "select * from " + obj + " where " + rMap[obj][key].sourceAttribute[0] + " = " + rMap[obj][key].targetAttributeValue[0] + ""; + var resultSet = kony.sync.executeSql(tx, sql, null); + if (resultSet !== false) { + if (resultSet.rows.length === 0) { + sync.log.error("Referential Integrity Check Failed", kony.sync.getErrorTable(kony.sync.errorCodeReferentialIntegrity, kony.sync.getReferetialIntegrityerrMessg(obj, rMap[obj][key].sourceAttribute, rMap[obj][key].targetAttributeValue))); + if(kony.sync.isNullOrUndefined(integrityFailedMap[rMap[obj][key].foreignKeyAttribute])){ + integrityFailedMap[rMap[obj][key].foreignKeyAttribute] = kony.sync.getReferetialIntegrityerrMessg(obj, rMap[obj][key].sourceAttribute, rMap[obj][key].targetAttributeValue); + }else{ + integrityFailedMap[rMap[obj][key].foreignKeyAttribute] = integrityFailedMap[rMap[obj][key].foreignKeyAttribute] + kony.sync.getReferetialIntegrityerrMessg(obj, rMap[obj][key].sourceAttribute, rMap[obj][key].targetAttributeValue); + } + }else { + integrityFailedMap[rMap[obj][key].foreignKeyAttribute] = false; + } + } else { + return false; + } + } + } + var logicalBreak = false; + for(var key in integrityFailedMap){ + if(integrityFailedMap[key] !== false){ + logicalBreak = true; + } + } + return logicalBreak === false?true:integrityFailedMap; +}; + +kony.sync.checkIntegrityinTransaction = function (tx, rMap) { + sync.log.trace("Entering kony.sync.checkIntegrityinTransactionFK "); + var integrityFailedMap = {}; + if(!kony.sync.enableORMValidations){ + return true; + } + + for(var obj in rMap){ + for (var key in rMap[obj]) { + var relationShipMap = rMap[obj][key]; + var whereClause = " where "; + for (var i = 0; i < relationShipMap.targetAttributeValue.length; i++) { + if (kony.sync.isNull(relationShipMap.targetAttributeValue[i])) { + continue; + } + if(integrityFailedMap[relationShipMap.foreignKeyAttribute[i]] === false){ + continue; + } + if(relationShipMap.targetAttributeValue[i] === ""){ + relationShipMap.targetAttributeValue[i] = "''"; + } + + whereClause = whereClause + relationShipMap.sourceAttribute[i] + " = " + relationShipMap.targetAttributeValue[i]; + + if(i != relationShipMap.targetAttributeValue.length - 1) { + whereClause = whereClause + " AND "; + } + }; + + var sql = "select * from " + obj + whereClause + ""; + var resultSet = kony.sync.executeSql(tx, sql, null); + if (resultSet !== false) { + if (resultSet.rows.length === 0) { + sync.log.error("Referential Integrity Check Failed", kony.sync.getErrorTable(kony.sync.errorCodeReferentialIntegrity, kony.sync.getReferetialIntegrityerrMessg(obj, relationShipMap.sourceAttribute, relationShipMap.targetAttributeValue))); + integrityFailedMap[relationShipMap.foreignKeyAttribute[0]] = kony.sync.getReferetialIntegrityerrMessg(obj, relationShipMap.sourceAttribute, relationShipMap.targetAttributeValue); + } + else{ + integrityFailedMap[relationShipMap.foreignKeyAttribute[0]] = false; + } + } else { + return false; + } + } + } + + var logicalBreak = false; + for(var key in integrityFailedMap){ + if(integrityFailedMap[key] !== false){ + logicalBreak = true; + } + } + return logicalBreak === false?true:integrityFailedMap; +}; + +kony.sync.convertOrderByMapToValuesTable = function (orderByMap) { + sync.log.trace("Entering kony.sync.convertOrderByMapToValuesTable "); + var valuesTable = {}; + for (var i in orderByMap) { + valuesTable[orderByMap[i].key] = orderByMap[i].key; + } + return valuesTable; +}; + +kony.sync.convertToValuesTableOrderByMap = function (orderByMap, valuesTable) { + sync.log.trace("Entering kony.sync.convertToValuesTableOrderByMap "); + var orderByMapFiltered = []; + var j = 0; + for(var i in orderByMap) { + if (valuesTable[orderByMap[i].key] === orderByMap[i].key) { + orderByMapFiltered[j] = orderByMap[i]; + j++; + } + } + return orderByMapFiltered; +}; + +kony.sync.isValidFunctionType = function (closure) { + sync.log.trace("Entering kony.sync.isValidFunctionType "); + return kony.type(closure) === "function"; +}; + +kony.sync.initializeScopeSettings = function (tx) { + sync.log.trace("Entering kony.sync.initializeScopeSettings "); + var query = kony.sync.qb_createQuery(); + var json = "{\"scopeSettings\" : {}}"; + kony.sync.qb_set(query, { + "id" : 1, + "action" : "", + "details" : json + }); + kony.sync.qb_insert(query, "konysyncDIAGNOSTICS"); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; + +kony.sync.updateScopeSettings = function (tx, scopename) { + sync.log.trace("Entering kony.sync.updateScopeSettings "); + var resultset = kony.sync.executeSql(tx, "select * from konysyncDIAGNOSTICS"); + if(resultset === false){ + return false; + } + var settings = ""; + var rowItem = null; + if(resultset.rows.length > 0){ + rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + settings = rowItem.details; + }else{ + sync.log.error("Updation of Scope Settings Failed"); + } + var table = JSON.parse(settings); + if(kony.sync.isNullOrUndefined(table.scopeSettings[scopename])){ + table.scopeSettings[scopename] = { + "initialize" : true + }; + }else if(kony.sync.isNullOrUndefined(table.scopeSettings[scopename].initialize)) { + table.scopeSettings[scopename].initialize = true; + } + var query = kony.sync.qb_createQuery(); + var json = JSON.stringify(table); + kony.sync.qb_set(query, { + "details" : json + }); + kony.sync.qb_update(query, "konysyncDIAGNOSTICS"); + kony.sync.qb_where(query, [{ + "key" : "id", + "value" : 1 + } + ]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; + +kony.sync.getScopeSettings = function (scopename, dbname, callback, errorcallback) { + sync.log.trace("Entering kony.sync.getScopeSettings "); + var settings = null; + var isError = false; + function getSettingsTransaction(tx) { + var resultset = kony.sync.executeSql(tx, "select * from konysyncDIAGNOSTICS"); + var set = ""; + var rowItem = null; + if (resultset !== false) { + if (resultset.rows.length > 0) { + rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + set = rowItem.details; + } else { + sync.log.error("Updation of Scope Settings Failed"); + } + } else { + sync.log.error("Updation of Scope Settings Failed"); + isError = true; + return; + } + var table = JSON.parse(set); + if(!kony.sync.isNullOrUndefined(table.scopeSettings[scopename])) { + settings = table.scopeSettings[scopename]; + } + } + + function getSettingsCompleted() { + callback(settings); + } + + function getSettingsFailed() { + kony.sync.callTransactionError(isError, errorcallback); + } + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, getSettingsFailed, "getScopeSettings"); + if(dbconnection !== null){ + kony.sync.startTransaction(dbconnection, getSettingsTransaction, getSettingsCompleted, getSettingsFailed); + } +}; + +kony.sync.isScopeInitialized = function (scopename, dbname, callback) { + sync.log.trace("Entering kony.sync.isScopeInitialized "); + function localcallback(settings) { + if (settings !== null){ + if(settings.initialize === true) { + callback(true); + } else { + callback(false); + } + } else { + callback(false); + } + } + + function errorCallback(res){ + kony.sync.onDownloadCompletion(true, res); + } + var settings = kony.sync.getScopeSettings(scopename, dbname, localcallback, errorCallback); +}; + +kony.sync.setPragmaSize = function (tx) { + sync.log.trace("Entering kony.sync.setPragmaSize "); + return kony.sync.executeSql(tx, "PRAGMA CACHE_SIZE=50"); +}; + +kony.sync.isValidJSTable = function(inputTable) { + if (kony.sync.isNullOrUndefined(inputTable)) { + return false; + } + return kony.type(inputTable) === "object" || kony.type(inputTable) === "Object" || kony.type(inputTable) === "Array"; +}; + +kony.sync.isNull = function (val) { + sync.log.trace("Entering kony.sync.isNull "); + if (kony.sync.isNullOrUndefined(val)){ + return true; + } + val = val + ""; + return (kony.string.equalsIgnoreCase(val, "null")); +}; + +//returns whether a error upload policy is continueonerror or not +kony.sync.isUploadErrorPolicyCOE = function (currentScope) { + sync.log.trace("Entering kony.sync.isUploadErrorPolicyCOE "); + var scopename = currentScope.ScopeName; + //Added these redundant checks to check for OTA or Persistent Sync. As proper checks + //have not made in earlier implementation, we are doing this to avoid any backward compatibility issues. + if(currentScope[kony.sync.syncStrategy] === kony.sync.syncStrategy_OTA) { + if (currentScope[kony.sync.syncStrategy] === kony.sync.syncStrategy_OTA && + !kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks]) && + !kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][scopename])&& + kony.string.equalsIgnoreCase(kony.sync.getString(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][scopename][kony.sync.sessionTaskUploadErrorPolicy]), kony.sync.sessionTaskUploadErrorPolicyCOE)){ + return true; + } + return false; + }else { + if (currentScope[kony.sync.syncStrategy] !== kony.sync.syncStrategy_OTA && + !kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks]) && + !kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][scopename])&& + kony.string.equalsIgnoreCase(kony.sync.getString(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][scopename][kony.sync.sessionTaskUploadErrorPolicy]), kony.sync.sessionTaskUploadErrorPolicyCOE)){ + return true; + } + return false; + } +}; + +kony.sync.isEmptyString = function (val) { + sync.log.trace("Entering kony.sync.isEmptyString "); + if(!kony.sync.isNullOrUndefined(val) && typeof(val)==="string" && val.trim()==="") { + return true; + } else { + return false; + } +}; + +kony.sync.isValidNumberType = function (val) { + sync.log.trace("Entering kony.sync.isValidNumberType "); + if (kony.string.equalsIgnoreCase(kony.type(val), "number")){ + return true; + } + else if (kony.string.equalsIgnoreCase(kony.type(val), "string") && null !== kony.sync.tonumber(val)){ + return true; + } + else{ + return false; + } + +}; + +kony.sync.isValidBooleanType = function (val) { + sync.log.trace("Entering kony.sync.isValidBooleanType "); + if (kony.string.equalsIgnoreCase(kony.type(val), "boolean")) { + return true; + } else if (kony.string.equalsIgnoreCase(kony.type(val), "string")) { + if (kony.string.equalsIgnoreCase(val, "false") || kony.string.equalsIgnoreCase(val, "true") || kony.string.equalsIgnoreCase(val, "0") || kony.string.equalsIgnoreCase(val, "1")) { + return true; + } + } else if (kony.string.equalsIgnoreCase(kony.type(val), "number")) { + if (val === 0 || val === 1) { + return true; + } + } + + return false; +}; + +kony.sync.isMaliciousType = function (val) { + sync.log.trace("Entering kony.sync.isMaliciousType "); + if (kony.sync.isValidNumberType(val) && isNaN(val)){ + return "NaN"; + } + if (val === Number.POSITIVE_INFINITY || val === Number.NEGATIVE_INFINITY){ + return "infinity"; + } + return false; +}; + +kony.sync.genMaliciousTypeCheck = function (obj, errorcallback) { + sync.log.trace("Entering kony.sync.genMaliciousTypeCheck "); + if(!kony.sync.enableORMValidations){ + return false; + } + var errorMessage = null; + var maliciousType = null; + if (kony.string.equalsIgnoreCase(kony.type(obj), "object") || kony.string.equalsIgnoreCase(kony.type(obj), "table")) { + for (var i in obj) { + maliciousType = kony.sync.isMaliciousType(obj[i]); + if (maliciousType !== false) { + errorMessage = kony.sync.getErrorMessage(kony.sync.errorCodeMaliciousType, i, maliciousType); + sync.log.error("Malicious object detected", kony.sync.getErrorTable(kony.sync.errorCodeMaliciousType, errorMessage)); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeMaliciousType, errorMessage)); + return true; + } else { + if (obj[i] === undefined){ + obj[i] = "null"; + } + } + } + } else { + maliciousType = kony.sync.isMaliciousType(obj); + if (maliciousType !== false) { + errorMessage = kony.sync.getErrorMessage(kony.sync.errorCodeMaliciousType, "", maliciousType); + sync.log.error("Malicious object detected", kony.sync.getErrorTable(kony.sync.errorCodeMaliciousType, errorMessage)); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeMaliciousType, errorMessage)); + return true; + } + } + return false; +}; + +kony.sync.getBoolean = function (val) { + sync.log.trace("Entering kony.sync.getBoolean "); + if (kony.sync.isValidBooleanType(val)) { + val = val + ""; + if (kony.string.equalsIgnoreCase(val, "true") || kony.string.equalsIgnoreCase(val, "1") || val === 1) { + return true; + } else { + return false; + } + } else { + return val; + } +}; + +kony.sync.getString = function (val) { + sync.log.trace("Entering kony.sync.getString "); + if (kony.sync.isNull(val)) { + return ""; + } + return val.toString(); +}; + +kony.sync.getUploadStatus = function (markForUpload) { + sync.log.trace("Entering kony.sync.getUploadStatus "); + if (markForUpload === false || markForUpload === "false") { + return false; + } else { + return true; + } +}; + +kony.sync.getDBName = function () { + sync.log.trace("Entering kony.sync.getDBName "); + var syncscopes = konysyncClientSyncConfig.ArrayOfSyncScope; + if(syncscopes === null){ + return null; + } + for (var i = 0; i < syncscopes.length; i++) { + var scope = syncscopes[i]; + //This logic needs to be changed when we have separate DB for each scope + if (scope[kony.sync.scopeDataSource] !== null) { + return scope[kony.sync.scopeDataSource]; + } + } + return null; +}; + +kony.sync.mergeTable = function (toObj, frmObj) { + sync.log.trace("Entering kony.sync.mergeTable "); + if (!kony.sync.isValidJSTable(frmObj)) { + return toObj; + } + if (!kony.sync.isValidJSTable(toObj)) { + return frmObj; + } + + for (var k in frmObj) { + toObj[k] = frmObj[k]; + } + + return toObj; +}; + +kony.sync.pkNotFoundErrCallback = function(errorcallback, objName){ + sync.log.trace("Entering kony.sync.pkNotFoundErrCallback "); + sync.log.error("No data with specified primary key found in SyncObject " + objName + "."); + errorcallback(kony.sync.getErrorTable(kony.sync.errorCodeNoDataWithPrimaryKey, kony.sync.getErrorMessage(kony.sync.errorCodeNoDataWithPrimaryKey, objName))); +}; + +kony.sync.skyEventObserver = function (event, args, eventFinishCallback, errorcallback, isCascade) { + sync.log.trace("Entering kony.sync.skyEventObserver "); + if (event !== "START") { + if (event === "ERROR") { + if (!kony.sync.isNull(args)) { + if (isCascade) { + sky.rollbackTransaction(kony.sky.skyEmptyFunction); + } + var errorCode = args.ERRORCODE; + var errorMsg = args.ERRORDESC; + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(errorCode, errorMsg)); + } + } + if (event === "FINISH") { + kony.sync.verifyAndCallClosure(eventFinishCallback, args); + } + } +}; + +kony.sync.removeCascadeHelper_old = function (tx, srcAttribute, targetAttribute, tbname, wcs, targetObjectRemoveCascade, targetObjectName, isCascade, errorcallback, markForUpload, pkRecord, isLocal) { + sync.log.trace("Entering kony.sync.removeCascadeHelper_old "); + var wcsCascade = null; + if (pkRecord === null) { + var sqlTarget = "select " + srcAttribute + " from " + tbname + wcs; + var resultSet = kony.sync.executeSql(tx, sqlTarget, null); + if (resultSet === false) { + return false; + } + var num_records = resultSet.rows.length; + if (num_records === 0) { + return true; + } + if (isCascade) { + sync.log.debug("No of Records to be deleted in " + targetObjectName + " for cascade delete=" + num_records); + } + for (var i = 0; i <= num_records - 1; i++) { + var record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + wcsCascade = " where " + targetAttribute + " = '" + record[srcAttribute] + "'"; + if (targetObjectRemoveCascade(tx, wcsCascade, errorcallback, markForUpload, isCascade, tbname, isLocal) === false) { + return false; + } + } + } else { + wcsCascade = " where " + targetAttribute + " = '" + pkRecord[srcAttribute] + "'"; + return targetObjectRemoveCascade(tx, wcsCascade, errorcallback, markForUpload, isCascade, tbname, isLocal); + } + return true; +}; + +kony.sync.removeCascadeHelper = function (tx,srcAttributes,targetAttributes, tbname, wcs, targetObjectRemoveCascade, targetObjectName, isCascade, errorcallback, markForUpload, pkRecord, isLocal) { + sync.log.trace("Entering kony.sync.removeCascadeHelper "); + var wcsCascade = null; + if (pkRecord === null) { + var sqlTarget = "select "; + var sourceAttribute = ""; + for (var i = 0; i < srcAttributes.length; i++) { + sourceAttribute = sourceAttribute + srcAttributes[i]; + if(i != srcAttributes.length - 1) { + sourceAttribute = sourceAttribute + "," + } + }; + sqlTarget = sqlTarget + sourceAttribute + " from " + tbname + wcs; + + var resultSet = kony.sync.executeSql(tx, sqlTarget, null); + if (resultSet === false) { + return false; + } + var num_records = resultSet.rows.length; + if (num_records === 0) { + return true; + } + if (isCascade) { + sync.log.debug("No of Records to be deleted in " + targetObjectName + " for cascade delete=" + num_records); + } + wcsCascade = " where "; + for (var i = 0; i <= num_records - 1; i++) { + var record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + var srcAttributesLen = srcAttributes.length; + for (var j = 0; j < srcAttributesLen ; ++j) { + wcsCascade = wcsCascade + targetAttributes[j] + " = '" + record[srcAttributes[j]] + "'" + if(j != srcAttributesLen - 1) { + wcsCascade = wcsCascade + " and " + } + } + if(i != num_records - 1) { + wcsCascade = wcsCascade + " or " ; + } + } + if (targetObjectRemoveCascade(tx, wcsCascade, errorcallback, markForUpload, isCascade, tbname, isLocal) === false) { + return false; + } + } + else { + wcsCascade = " where "; + var srcAttributesLen = srcAttributes.length; + for (var j = 0; j < srcAttributesLen ; j++) { + wcsCascade = wcsCascade + targetAttributes[j] + " = '" + pkRecord[srcAttributes[j]] + "'" + if(j != srcAttributesLen - 1) { + wcsCascade = wcsCascade + " and " + } + } + return targetObjectRemoveCascade(tx, wcsCascade, errorcallback, markForUpload, isCascade, tbname, isLocal); + } + return true; +}; + +kony.sync.rollbackTransaction = function (tx) { + sync.log.trace("Entering kony.sync.rollbackTransaction "); + function dummyError() { + //rollback the transaction + return true; + } + //dummy statement + kony.db.executeSql(tx, "dummy", null, dummyError); +}; + +//Wrapper for kony.db.executeSql +kony.sync.executeSql = function (tx, sql, params, errorCallback, rollback, opMsg) { + sync.log.trace("Entering kony.sync.executeSql "); + kony.sync.errorObject = null; + if (!kony.sync.isNullOrUndefined(opMsg)) { + sync.log.debug(opMsg); + } + sync.log.debug("SQL Query : ", sql); + sync.log.debug("SQL Params : ", params); + var result = kony.db.executeSql(tx, sql, params, localErrorCallback); + if (result === null) { + sync.log.error("Query execution failed: " + sql + " with params : ",params); + return false; + } else { + sync.log.debug("Query execution success: "+ sql + " with params : ",params); + sync.log.debug("Result of query execution is: ", result); + return result; + } + function localErrorCallback(tx, res) { + var errorInfo = {}; + errorInfo[kony.sync.errorInfoTransactionID] = tx; + errorInfo[kony.sync.errorInfoDatabaseError] = res; + sync.log.error("SQLite Error : ", res); + kony.sync.errorObject = kony.sync.getErrorTable(kony.sync.errorCodeSQLStatement, kony.sync.getErrorMessage(kony.sync.errorCodeSQLStatement), errorInfo); + // kony.sync.verifyAndCallClosure(errorCallback, kony.sync.getErrorTable(kony.sync.errorCodeSQLStatement, kony.sync.getErrorMessage(kony.sync.errorCodeSQLStatement), errorInfo)); + if (rollback === false) { + return false; + } else { + return true; + } + } +}; + +kony.sync.callTransactionError = function(isError, errorcallback){ + sync.log.trace("Entering kony.sync.callTransactionError "); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getTransactionError(isError)); +}; + +kony.sync.validateWhereClause = function(wcs){ + sync.log.trace("Entering kony.sync.validateWhereClause "); + if(!kony.sync.enableORMValidations){ + return wcs; + } + if(kony.sync.isNull(wcs)){ + return ""; + } + wcs = kony.sync.getString(wcs); + wcs = kony.string.trim(wcs); + var twcs = kony.string.lower(wcs); + + if(twcs !== ""){ + // check if the where clause starts with a reserved keyword, else append "where" keyword + if(!kony.sync.startsWithKeyword(twcs)){ + wcs = " where " + wcs; + } + } + return wcs; +}; + +//check whether the given data contains the key +kony.sync.contains = function(data, key){ + sync.log.trace("Entering kony.sync.contains "); + //currently implementing for array only + for(var i in data){ + if(data[i]===key){ + return true; + } + } + return false; +}; + +kony.sync.createHash = function(hash, plaintext){ + sync.log.trace("Entering kony.sync.createHash "); + return kony.crypto.createHash(hash, plaintext); +}; + +kony.sync.getChunkDownloadURL = function(){ + sync.log.trace("Entering kony.sync.getChunkDownloadURL "); + var server = kony.sync.getServerURL(); + return server + "downloadchunk"; +}; + +kony.sync.getUploadBatchSize = function(){ + sync.log.trace("Entering kony.sync.getUploadBatchSize "); + if (kony.sync.isValidNumberType(kony.sync.currentSyncConfigParams.uploadbatchsize)) { + return kony.sync.tonumber(kony.sync.currentSyncConfigParams.uploadbatchsize); + } + return 50; //default batch size +}; +kony.sync.isValidJSTable = function (inputTable){ + if (kony.sync.isNullOrUndefined(inputTable)) { + return false; + } + if (kony.type(inputTable) === "object" || kony.type(inputTable) === "Array") { + return true; + } else { + return false; + } +}; + +kony.sync.deleteMapKey = function(map, key){ + sync.log.trace("Entering kony.sync.deleteMapKey "); + if(!kony.sync.isNull(map) && !kony.sync.isNull(key)){ + delete map[key]; + } +}; + +kony.sync.getServerDetailsHostName = function(response){ + sync.log.trace("Entering kony.sync.getServerDetailsHostName "); + if(!kony.sync.isNullOrUndefined(response) && !kony.sync.isNullOrUndefined(response.d) && !kony.sync.isNullOrUndefined(response.d.server)){ + return response.d.server.hostName; + }else{ + return null; + } +}; + +kony.sync.getServerDetailsIpAddress = function(response){ + sync.log.trace("Entering kony.sync.getServerDetailsIpAddress "); + if(!kony.sync.isNullOrUndefined(response) && !kony.sync.isNullOrUndefined(response.d) && !kony.sync.isNullOrUndefined(response.d.server)){ + return response.d.server.ipAddress; + }else{ + return null; + } +}; + +kony.sync.addServerDetails = function(returnParams, serverResponse){ + if(!kony.sync.isNullOrUndefined(returnParams)){ + returnParams[kony.sync.serverDetails] = {}; + returnParams[kony.sync.serverDetails][kony.sync.hostName] = kony.sync.getServerDetailsHostName(serverResponse); + returnParams[kony.sync.serverDetails][kony.sync.ipAddress] = kony.sync.getServerDetailsIpAddress(serverResponse); + } +}; + +//This function gets connection +kony.sync.getConnectionOnly = function(dbName, displayName, errorCallback, moduleName) { + sync.log.trace("Entering kony.sync.getConnectionOnly "); + var estimatedDBSize = 5 * 1024 * 1024; + var connection = null; + var version = "1.0"; + var exceptionObject = null; + function makeEncryptedConnection(){ + if(kony.sync.deviceDBEncryptionKey===null){ + connection = kony.db.openDatabaseSync(dbName, version, displayName, estimatedDBSize); + } + else{ + sync.log.info("Opening encrypted connection", kony.sync.deviceDBEncryptionKey); + connection = kony.db.openDatabaseSync(dbName, version, displayName, estimatedDBSize, kony.sync.deviceDBEncryptionKey); + } + } + try{ + //#ifdef KONYSYNC_ENCRYPTION_AVAILABLE + makeEncryptedConnection(); + //#else + connection = kony.db.openDatabaseSync(dbName, version, displayName, estimatedDBSize); + //#endif + }catch(e){ + connection = null; + exceptionObject = e; + } + if(connection === null){ + if(kony.sync.isNullOrUndefined(moduleName)){ + moduleName = ""; + }else{ + moduleName += ": "; + } + sync.log.fatal(moduleName + "Error in getting connection"); + kony.sync.verifyAndCallClosure(errorCallback, kony.sync.getErrorTable(kony.sync.errorCodeDbConnection, kony.sync.getErrorMessage(kony.sync.errorCodeDbConnection), exceptionObject)); + } + return connection; +}; + +kony.sync.createDBEncryptionKey = function(passPhrase){ + sync.log.trace("Entering kony.sync.createDBEncryptionKey "); + if(kony.sync.deviceDBEncryptionKey===null && passPhrase!==null && passPhrase!==undefined && !kony.sync.isEmptyString(passPhrase)){ + //#ifdef KONYSYNC_IOS + kony.sync.deviceDBEncryptionKey = ["PRAGMA key = '" + passPhrase + "'"]; + //#endif + //#ifdef KONYSYNC_ANDROID + kony.sync.deviceDBEncryptionKey = passPhrase; + //#endif + //#ifdef KONYSYNC_WINDOWS + kony.sync.deviceDBEncryptionKey = passPhrase; + //#endif + } +}; + +kony.sync.isValidFunctionType = function (closure) { + sync.log.trace("Entering kony.sync.isValidFunctionType "); + return kony.type(closure) === "function"; +}; + +kony.sync.getTransactionError = function(isError){ + sync.log.trace("Entering kony.sync.getTransactionError "); + if (!isError) { + sync.log.error("Transaction error occurred : ", kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + return kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null); + } + else{ + sync.log.error("Statement error occurred : ", kony.sync.errorObject); + return kony.sync.errorObject; + } +}; + +kony.sync.isNullOrUndefined = function(val){ + if(val === null || val === undefined){ + return true; + }else{ + return false; + } +}; + +kony.sync.formOrderByClause = function(tablename, map){ + sync.log.trace("Entering kony.sync.formOrderByClause function"); + if(map !== null && map !== undefined){ + var scope = kony.sync.scopes[kony.sync.scopes.syncTableScopeDic[tablename]]; + var columns = scope.syncTableDic[tablename].ColumnsDic; + for (var k=0;k < map.length; k++){ + var v = map[k]; + if(!kony.sync.isValidJSTable(v)){ + sync.log.warn("Ignoring the orderby entry " + v + " as it is not a valid js object"); + delete map[k]; + continue; + } + if(kony.sync.isNull(columns[v.key])){ + sync.log.warn("Ignoring the orderby entry " + v.key + " for the SyncObject " + tablename + ". " + v.key + " is not defined as an attribute in SyncConfiguration."); + delete map[k]; + } + } + //var valuestable = kony.sync.convertOrderByMapToValuesTable(map); + //return kony.sync.convertToValuesTableOrderByMap(map,valuestable); + return map; + } +}; + + +//function to check if where clause starts with a SQLite reserved keyword +kony.sync.startsWithKeyword = function (wcs) { + var keywordTable = ["where ", "limit ", "group ", "order ", "join "]; + for(var i = 0 ; i < keywordTable.length ; i++) { + if(kony.string.startsWith(wcs, keywordTable[i])){ + return true; + } + } + return false; +}; + +kony.sync.getChannelName = function(){ + var returnVal = ""; + //#ifdef KONYSYNC_MOBILE + returnVal = "mobile"; + //#endif + //#ifdef KONYSYNC_TAB + returnVal = "tablet"; + //#endif + //#ifdef KONYSYNC_DESKTOP + returnVal = "desktop"; + //#endif + return returnVal; +}; + + +kony.sync.getPlatformName = function(){ + var returnVal = ""; + //#ifdef KONYSYNC_IOS + returnVal = "ios"; + //#endif + //#ifdef KONYSYNC_WINDOWS + returnVal = "windows"; + //#endif + //#ifdef KONYSYNC_ANDROID + returnVal = "android"; + //#endif + //#ifdef KONYSYNC_J2ME + returnVal = "j2me"; + //#endif + //#ifdef KONYSYNC_BB + returnVal = "blackberry"; + //#endif + return returnVal; +}; +// **************** End KonySyncHelper.js******************* + + +// **************** Start KonySyncInit.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} + +if(typeof(sync)=== "undefined"){ + sync = {}; +} + +if(typeof(kony.sync.blobManager) === "undefined") { + kony.sync.blobManager = {}; +} + +//Initializes the DB with Generated Scope +sync.init = function(on_sync_init_success, on_sync_init_error) { + if(kony.sync.isValidJSTable(on_sync_init_success)===true){ + //new style, user called as sync.init(config) + on_sync_init_error = on_sync_init_success[kony.sync.onSyncInitErrorParam]; + kony.sync.createDBEncryptionKey(on_sync_init_success[kony.sync.deviceDBEncryptionKeyParam]); + on_sync_init_success = on_sync_init_success[kony.sync.onSyncInitSuccessParam]; + } + // Create the database from xml. It also contains the provisioning commands + var syncscopes = konysyncClientSyncConfig.ArrayOfSyncScope; + kony.sync.syncConfigurationDBName = konysyncClientSyncConfig.AppID; + var isError = false; + var dbExists = false; + + function loadDatabase() { + sync.log.trace("Entering loadDatabase"); + var createDB = false; + syncscopes.syncTableScopeDic = []; + syncscopes.syncScopeBlobInfoMap = {}; + var currentscope = null; + var currenttemptable = null; + sync.log.info("loading DB"); + + function dbValidationCompleted() { + sync.log.trace("Entering dbValidationCompleted"); + loadSyncScope(0); + } + + function loadDatabaseTransaction(tx) { + sync.log.trace("Entering loadDatabaseTransaction"); + // this is to be uncommented when we have db for each scope + //for i, ddl in ipairs ( DDLCommands[currentscope[kony.sync.scopeName]] ) do + var DDLCommands = null; + if ((kony.sync.getBackEndDBType() === kony.sync.dbTypeSQLCE)) { + DDLCommands = konysyncSQLCEDDLCommands; + } else { + DDLCommands = konysyncSQLLiteDDLCommands; + } + if(!kony.sync.isNullOrUndefined(DDLCommands)){ + for (var i = 0; i < DDLCommands.length; i++) { + var ddl = DDLCommands[i]; + sync.log.debug("ddl :" + ddl); + if(kony.sync.executeSql(tx, ddl)===false){ + isError = true; + return; + } + } + } + if(kony.sync.initializeScopeSettings(tx)===false){ + isError = true; + return; + } + if(kony.sync.setPragmaSize(tx)===false){ + isError = true; + return; + } + } + + function dbexistsErrorCallback() { + sync.log.trace("Entering dbexistsErrorCallback"); + //Create DB + createDB = true; + sync.log.info("creating DB"); + var conn = kony.sync.getConnectionOnly(currentscope[kony.sync.scopeDataSource], currentscope[kony.sync.scopeDataSource], on_sync_init_error); + if(conn!==null){ + kony.sync.startTransaction(conn, loadDatabaseTransaction, dbValidationCompleted, initTransactionError); + } + } + + function dbexistsSuccessCallback() { + sync.log.trace("Entering dbexistsSuccessCallback"); + loadSyncScope(0); + } + + //for a given table getting the reverseRelationships information + //for a child table getting the relationship data from a parent where child is targetobject + function getParentRelationships(currentscope,synctable){ + parentRelationshipMap = {}; + scopeTables = currentscope.ScopeTables; + if(!kony.sync.isNullOrUndefined(scope.ScopeTables)){ + tables_length = scopeTables.length; + for(var i=0;i 0){ + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + if (!kony.sync.isNullOrUndefined(rowItem[kony.sync.metaTableSyncVersionCloumn])) { + kony.sync.currentSyncScopesState[scope.ScopeName] = rowItem[kony.sync.metaTableSyncVersionCloumn]; + } else { + kony.sync.isResetInProgress = false; + isError = true; + } + } + else { + kony.sync.isResetInProgress = false; + isError = true; + } + } + //Check for Sync Version 5.5.6 + if(kony.sync.checkForUpdate556to559Schema(tx) === false){ + isError = true; + } + //Check for Sync Version 5.5.9 + if(kony.sync.checkForUpdate559to560Schema(tx) === false){ + isError = true; + } + } + + function loadSyncScopeSuccess() { + sync.log.trace("Entering loadSyncScopeSuccess"); + //schema changed + if(kony.sync.configVersion !== konysyncClientSyncConfig.Version){ + kony.sync.schemaUpgradeNeeded = true; + //kony.sync.verifyAndCallClosure(on_sync_init_error, kony.sync.getSchemaUpgradeNeededError()); + //return; + } + if(isError === true){ + kony.sync.verifyAndCallClosure(on_sync_init_error, kony.sync.getScopeLoadingFailed()); + } + if (scopeindex !== kony.sync.scopes.length - 1) { + loadSyncScope(scopeindex + 1); + } else { + checkForStaleScope(checkForStaleScopeCallback); + } + } + + function checkForStaleScopeCallback(){ + kony.sync.isResetInProgress = false; + kony.sync.syncInitialized = true; + //init the onDemand polling thread + //TODO - returns function handler. + if(typeof(sync.util) !== "undefined") { + sync.util.onDemandThreadInit( + kony.sync.blobManager.getNextOnDemandJob, + kony.sync.blobManager.onDemandUniversalSuccessCallback, + kony.sync.blobManager.onDemandUniversalErrorCallback); + + } + //TODO : handling error in thread init. + //init the binaryNotifier map + kony.sync.blobManager.binaryNotifierMap = {}; + + kony.sync.verifyAndCallClosure(on_sync_init_success); + } + + function checkForStaleScope(callback){ + var connection = kony.sync.getConnectionOnly(kony.sync.scopes[0][kony.sync.scopeDataSource], kony.sync.scopes[0][kony.sync.scopeDataSource], on_sync_init_error); + if(connection!==null){ + kony.sync.startTransaction(connection, transactionCallback, transactionSuccessCallback, initTransactionError); + } + + function transactionCallback(tx){ + //Create ScopeMap + var scopeNames = ""; + for(var i=0;i 0)) { + kony.sync.pendingAckCount = kony.sync.pendingAckCount + num_records; + //table.insert(kony.sync.pendingAckResult,tableData); + kony.sync.pendingAckResult[tbname] = {}; + kony.sync.pendingAckResult[tbname].count = num_records; + kony.sync.pendingAckResult[tbname].data = tableData; + } + } + if(!kony.sync.isNullOrUndefined(currentScope.ScopeTables)){ + for (var i = 0; i < currentScope.ScopeTables.length; i++) { + var syncTable = currentScope.ScopeTables[i]; + var tbname = syncTable.Name; + var currentversion = kony.sync.getCurrentVersionNumber(tbname); + var sql = "select * from " + tbname + " WHERE " + kony.sync.mainTableChangeTypeColumn + " is not null AND " + kony.sync.mainTableChangeTypeColumn + " <> -1 AND " + kony.sync.mainTableSyncVersionColumn + " <> " + currentversion + " AND " + kony.sync.mainTableChangeTypeColumn + " NOT LIKE '9%'"; + if(single_transaction_callback_local(sql, null, tbname)===false){ + return; + } + } + } + } + + function konysyncPendingAck_transactionSucessCallback() { + sync.log.trace("Entering konysyncPendingAck_transactionSucessCallback"); + sync.log.info("Get Pending Acknowledgement Count = ", kony.sync.pendingAckCount); + sync.log.info("Get Pending Acknowledgement = ", kony.sync.pendingAckResult); + if ((kony.sync.pendingAckIndex === kony.sync.scopes.scopecount - 1)) { + var konysyncPendingAckDic = {}; + konysyncPendingAckDic.totalCount = kony.sync.pendingAckCount; + konysyncPendingAckDic.totalData = kony.sync.pendingAckResult; + kony.sync.verifyAndCallClosure(successcallback, konysyncPendingAckDic); + } else { + kony.sync.pendingAckIndex = kony.sync.pendingAckIndex + 1; + currentScope = kony.sync.scopes[kony.sync.pendingAckIndex]; + dbname = currentScope[kony.sync.scopeDataSource]; + dbconnection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback); + if (dbconnection !== null){ + kony.sync.startTransaction(dbconnection, konysyncPendingAck_transaction, konysyncPendingAck_transactionSucessCallback, konysyncPendingAck_transactionErrorCallback, "Get Pending Acknowledgement"); + } + } + } + + function konysyncPendingAck_transactionErrorCallback() { + sync.log.trace("Entering konysyncPendingAck_transactionErrorCallback"); + kony.sync.callTransactionError(isError, errorcallback); + } + if(dbconnection!==null){ + kony.sync.startTransaction(dbconnection, konysyncPendingAck_transaction, konysyncPendingAck_transactionSucessCallback, konysyncPendingAck_transactionErrorCallback, "Get Pending Acknowledgement"); + } +}; + +sync.getPendingUpload = function(successcallback, errorcallback) { + if(!kony.sync.isSyncInitialized(errorcallback)){ + return; + } + kony.sync.pendingUploadIndex = 0; + kony.sync.pendingUploadResult = {}; + var currentScope = kony.sync.scopes[0]; + var dbname = currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback); + kony.sync.pendingUploadCount = 0; + var isError = false; + + function konysyncPendingUpload_transaction(tx) { + sync.log.trace("Entering konysyncPendingUpload_transaction"); + function single_transaction_callback_local(sql, params, tbname) { + sync.log.trace("Entering single_transaction_callback_local"); + var resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet===false){ + isError = false; + return false; + } + var tableData = []; + var num_records = resultSet.rows.length; + for (var j = 0; j <= num_records - 1; j++) { + var record = kony.db.sqlResultsetRowItem(tx, resultSet, j); + kony.table.insert(tableData, record); + } + if ((num_records > 0)) { + kony.sync.pendingUploadCount = kony.sync.pendingUploadCount + num_records; + kony.sync.pendingUploadResult[tbname] = {}; + kony.sync.pendingUploadResult[tbname].count = num_records; + kony.sync.pendingUploadResult[tbname].data = tableData; + } + } + if(!kony.sync.isNullOrUndefined(currentScope.ScopeTables)){ + for (var i = 0; i < currentScope.ScopeTables.length; i++) { + var syncTable = currentScope.ScopeTables[i]; + var tbname = syncTable.Name; + var currentversion = kony.sync.getCurrentVersionNumber(tbname); + var sql = "select * from " + tbname + " WHERE " + kony.sync.mainTableChangeTypeColumn + " is not null AND " + kony.sync.mainTableChangeTypeColumn + " <> -1 AND " + kony.sync.mainTableSyncVersionColumn + " = " + currentversion + " AND " + kony.sync.mainTableChangeTypeColumn + " NOT LIKE '9%'"; + if(single_transaction_callback_local(sql, null, tbname)===false){ + return; + } + } + } + } + + function konysyncPendingUpload_transactionSucessCallback() { + sync.log.trace("Entering konysyncPendingUpload_transactionSucessCallback"); + sync.log.info("Pending Uploads Count = ", kony.sync.pendingUploadCount); + + sync.log.info("Pending Uploads = ", kony.sync.pendingUploadResult); + if ((kony.sync.pendingUploadIndex === kony.sync.scopes.scopecount - 1)) { + var konysyncPendingUploadDic = {}; + konysyncPendingUploadDic.totalCount = kony.sync.pendingUploadCount; + konysyncPendingUploadDic.totalData = kony.sync.pendingUploadResult; + kony.sync.verifyAndCallClosure(successcallback, konysyncPendingUploadDic); + } else { + kony.sync.pendingUploadIndex = kony.sync.pendingUploadIndex + 1; + currentScope = kony.sync.scopes[kony.sync.pendingUploadIndex]; + dbname = currentScope[kony.sync.scopeDataSource]; + dbconnection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback); + if(dbconnection !== null){ + kony.sync.startTransaction(dbconnection, konysyncPendingUpload_transaction, konysyncPendingUpload_transactionSucessCallback, transactionErrorCallback, "Get Pending Upload"); + } + } + } + + function transactionErrorCallback() { + sync.log.trace("Entering transactionErrorCallback"); + kony.sync.callTransactionError(isError, errorcallback); + } + if(dbconnection !== null){ + kony.sync.startTransaction(dbconnection, konysyncPendingUpload_transaction, konysyncPendingUpload_transactionSucessCallback, transactionErrorCallback, "Get Pending Upload"); + } +}; + +sync.getDeferredUpload = function(successcallback, errorcallback) { + if(!kony.sync.isSyncInitialized(errorcallback)){ + return; + } + kony.sync.deferredUploadIndex = 0; + kony.sync.deferredUploadResult = {}; + var currentScope = kony.sync.scopes[0]; + var dbname = currentScope[kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback); + kony.sync.deferredUploadCount = 0; + var isError = false; + + function konysyncDeferredUpload_transaction(tx) { + sync.log.trace("Entering konysyncDeferredUpload_transaction"); + function single_transaction_callback_local(sql, params, tbname) { + sync.log.trace("Entering single_transaction_callback_local"); + var resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet===false){ + isError = true; + return false; + } + var tableData = []; + var num_records = resultSet.rows.length; + for (var j = 0; j <= num_records - 1; j++) { + var record = kony.db.sqlResultsetRowItem(tx, resultSet, j); + kony.table.insert(tableData, record); + } + if ((num_records > 0)) { + kony.sync.deferredUploadCount = kony.sync.deferredUploadCount + num_records; + kony.sync.deferredUploadResult[tbname] = {}; + kony.sync.deferredUploadResult[tbname].count = num_records; + kony.sync.deferredUploadResult[tbname].data = tableData; + } + } + if(!kony.sync.isNullOrUndefined(currentScope.ScopeTables)){ + for (var i = 0; i < currentScope.ScopeTables.length; i++) { + var syncTable = currentScope.ScopeTables[i]; + var tbname = syncTable.Name; + var sql = "select * from " + tbname + " WHERE " + kony.sync.mainTableChangeTypeColumn + " is not null AND " + kony.sync.mainTableChangeTypeColumn + " <> -1 AND " + kony.sync.mainTableChangeTypeColumn + " LIKE '9%'"; + if(single_transaction_callback_local(sql, null, tbname)===false){ + return; + } + } + } + } + + function konysyncDeferredUpload_transactionSucessCallback() { + sync.log.trace("Entering konysyncDeferredUpload_transactionSucessCallback"); + sync.log.info("Deferred Uploads Count = ", kony.sync.deferredUploadCount); + + sync.log.info("Deferred Uploads = ", kony.sync.deferredUploadResult); + if ((kony.sync.deferredUploadIndex === kony.sync.scopes.scopecount - 1)) { + var konysyncDeferredUploadDic = {}; + konysyncDeferredUploadDic.totalCount = kony.sync.deferredUploadCount; + konysyncDeferredUploadDic.totalData = kony.sync.deferredUploadResult; + kony.sync.verifyAndCallClosure(successcallback, konysyncDeferredUploadDic); + } else { + kony.sync.deferredUploadIndex = kony.sync.deferredUploadIndex + 1; + currentScope = kony.sync.scopes[kony.sync.deferredUploadIndex]; + dbname = currentScope[kony.sync.scopeDataSource]; + dbconnection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback); + if (dbconnection !== null){ + kony.sync.startTransaction(dbconnection, konysyncDeferredUpload_transaction, konysyncDeferredUpload_transactionSucessCallback, transactionErrorCallback, "Get Deferred Upload"); + } + } + } + + function transactionErrorCallback() { + sync.log.trace("Entering transactionErrorCallback"); + kony.sync.callTransactionError(isError, errorcallback); + } + if (dbconnection !== null){ + kony.sync.startTransaction(dbconnection, konysyncDeferredUpload_transaction, konysyncDeferredUpload_transactionSucessCallback, transactionErrorCallback, "Get Deferred Upload"); + } +}; + +sync.getAllPendingUploadInstances = function(retrieveOnlyCount, successcallback, errorcallback) { + sync.log.trace("Entering sync.getAllPendingUploadInstances"); + if(!kony.sync.isSyncInitialized(errorcallback)){ + return; + } + var pendingUploadResult = {}; + pendingUploadResult.totalCount = 0; + var dbname = kony.sync.scopes[0][kony.sync.scopeDataSource]; + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback); + if(dbconnection !== null){ + kony.db.transaction(dbconnection, pendingUploadTransaction, pendingUploadTransactionErrorCallback, pendingUploadTransactionSucessCallback); + } + var isError = false; + function pendingUploadTransaction(tx){ + sync.log.trace("Entering sync.getAllPendingUploadInstances->pendingUploadTransaction"); + for(var i=0; i < kony.sync.scopes.length; i++){ + var currentScope = kony.sync.scopes[i]; + var scopeName = currentScope[kony.sync.scopeName]; + pendingUploadResult[scopeName] = {}; + pendingUploadResult[scopeName].count = 0; + /*get syncversion from metatable*/ + var syncversion = 0; + var query = kony.sync.qb_createQuery() ; + kony.sync.qb_select(query, [kony.sync.metaTableSyncVersionCloumn]); + kony.sync.qb_from(query, kony.sync.metaTableName); + kony.sync.qb_where(query, [{ + key: kony.sync.metaTableScopeColumn, + value: scopeName + }, { + key: kony.sync.metaTableFilterValue, + value: "no filter" + }]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(tx, sql, params); + if(resultset===false){ + isError = true; + return; + } + var row = kony.db.sqlResultsetRowItem(tx, resultset, 0); + syncversion = row[kony.sync.metaTableSyncVersionCloumn]; + + for (var j = 0; !kony.sync.isNull(currentScope.ScopeTables) && j < currentScope.ScopeTables.length; j++) { + var syncTable = currentScope.ScopeTables[j]; + //not using query builder to speedup time + if(retrieveOnlyCount!==true){ + sql = "select * from " + syncTable.Name + kony.sync.historyTableName + " where " + kony.sync.historyTableChangeTypeColumn + " NOT LIKE '9%' AND " + + kony.sync.historyTableSyncVersionColumn + " = " + syncversion; + } + else{ + sql = "select count(*) from " + syncTable.Name + kony.sync.historyTableName + " where " + kony.sync.historyTableChangeTypeColumn + " NOT LIKE '9%' AND " + + kony.sync.historyTableSyncVersionColumn + " = " + syncversion; + } + resultset = kony.sync.executeSql(tx, sql, null); + if(resultset === false){ + isError = true; + return; + } + pendingUploadResult[scopeName][syncTable.Name] = {}; + if(retrieveOnlyCount!==true){ + pendingUploadResult[scopeName][syncTable.Name].count = resultset.rows.length; + pendingUploadResult[scopeName][syncTable.Name].data = []; + for (var k = 0; k < resultset.rows.length; k++) { + pendingUploadResult[scopeName][syncTable.Name].data[k] = kony.db.sqlResultsetRowItem(tx, resultset, k); + } + } + else{ + var rowCount = kony.db.sqlResultsetRowItem(tx, resultset, 0); + pendingUploadResult[scopeName][syncTable.Name].count = rowCount["count(*)"]; + } + pendingUploadResult[scopeName].count += pendingUploadResult[scopeName][syncTable.Name].count; + pendingUploadResult.totalCount += pendingUploadResult[scopeName][syncTable.Name].count; + } + } + } + + function pendingUploadTransactionErrorCallback(){ + sync.log.trace("Entering sync.getAllPendingUploadInstances->pendingUploadTransactionErrorCallback"); + kony.sync.verifyAndCallClosure(errorcallback); + } + function pendingUploadTransactionSucessCallback(){ + sync.log.trace("Entering sync.getAllPendingUploadInstances->pendingUploadTransactionSucessCallback"); + sync.log.info("getAllPendingUploadInstances success", pendingUploadResult); + kony.sync.verifyAndCallClosure(successcallback, pendingUploadResult); + } +}; + +kony.sync.checkForUpdate556to559Schema = function(tx){ + var sql = "select count(*) from " + kony.sync.chunkTableName; + var resultSet = kony.sync.executeSql(tx, sql, null,null,false); + if(resultSet === false){ + //Alter scripts for 5.5.6 to 5.5.9 DB Update + kony.sync.DDL556to559Update = [ + "ALTER TABLE " + kony.sync.metaTableName + " ADD COLUMN " + kony.sync.metaTableUploadSyncTimeColumn + " nvarchar(1000)", + "CREATE TABLE " + kony.sync.pendingUploadTableName + " (" + kony.sync.metaTableScopeColumn + " nvarchar(100) not null," + kony.sync.pendingUploadTableUploadRequest + " text," + kony.sync.objectLevelInfo + " text," + kony.sync.pendingUploadTableInsertCount + " int," + kony.sync.pendingUploadTableUpdateCount + " int," + kony.sync.pendingUploadTableDeleteCount + " int," + kony.sync.pendingUploadTableBatchInsertCount + " int," + kony.sync.pendingUploadTableBatchUpdateCount + " int," + kony.sync.pendingUploadTableBatchDeleteCount + " int," + kony.sync.pendingUploadTableUploadLimit + " int,primary key (" + kony.sync.metaTableScopeColumn + "))", + "CREATE TABLE " + kony.sync.chunkTableName + " (" + kony.sync.chunkTableChunkId + " int not null," + kony.sync.chunkTablePayloadId + " nvarchar(50) not null," + kony.sync.metaTableScopeColumn + " nvarchar(100) not null," + kony.sync.chunkTableChunkData + " text," + kony.sync.chunkTableTimeStamp + " nvarchar(50),primary key (" + kony.sync.chunkTableChunkId + ", " + kony.sync.chunkTablePayloadId + ", " + kony.sync.metaTableScopeColumn + "))", + "CREATE TABLE " + kony.sync.chunkMetaTableName + " (" + kony.sync.chunkTablePayloadId + " nvarchar(50) not null," + kony.sync.metaTableScopeColumn + " nvarchar(100) not null," + kony.sync.metaTableChunkAck + " int," + kony.sync.metaTableChunkSize + " int," + kony.sync.metaTableChunkCount + " int," + kony.sync.metaTableChunkHashSum + " nvarchar(35)," + kony.sync.metaTableChunkDiscarded + " int,primary key (" + kony.sync.chunkTablePayloadId + ", "+ kony.sync.metaTableScopeColumn + "))" + ]; + } + return kony.sync.executeQueriesInTransaction(tx, kony.sync.DDL556to559Update); +}; + +kony.sync.checkForUpdate559to560Schema = function(tx){ + var sql = "select count(" + kony.sync.metaTableSchemaUpgradeSyncTimeColumn + ") from " + kony.sync.metaTableName; + var resultSet = kony.sync.executeSql(tx, sql, null,null,false); + if(resultSet === false){ + //Alter scripts for 5.5.9 to 5.6.0 DB Update + kony.sync.configVersion = konysyncClientSyncConfig.Version; + kony.sync.DDL559to560Update = [ + "ALTER TABLE " + kony.sync.syncConfigurationTableName + " ADD COLUMN " + kony.sync.syncConfigurationColumnSchemaUpgradeContext + " nvarchar(4000)", + "ALTER TABLE " + kony.sync.syncConfigurationTableName + " ADD COLUMN " + kony.sync.syncConfigurationColumnVersion + " nvarchar(4000)", + "ALTER TABLE " + kony.sync.metaTableName + " ADD COLUMN " + kony.sync.metaTableSchemaUpgradeSyncTimeColumn + " nvarchar(1000)", + "UPDATE " + kony.sync.syncConfigurationTableName + " SET " + kony.sync.syncConfigurationColumnVersion + " = '" + konysyncClientSyncConfig.Version + "' where rowid = 1" + ]; + } + return kony.sync.executeQueriesInTransaction(tx, kony.sync.DDL559to560Update); +}; +// **************** End KonySyncInit.js******************* + + +// **************** Start KonySyncLogger.js******************* +if (typeof(kony.sync) === "undefined") { + kony.sync = {}; +} + +if (typeof(kony.sync.log) === "undefined") { + kony.sync.log = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} +sync.log = {}; + +//TRACE(6) > DEBUG(5) > INFO(4) > WARN(3) > ERROR(2) > FATAL(1) > NONE(0) +kony.sync.log.NONE = { + value : 0, + name : "none", + code : "NONE" +}; +kony.sync.log.FATAL = { + value : 1, + name : "fatal", + code : "FATAL" +}; +kony.sync.log.ERROR = { + value : 2, + name : "error", + code : "ERROR" +}; +kony.sync.log.WARN = { + value : 3, + name : "warn", + code : "WARN" +}; +kony.sync.log.INFO = { + value : 4, + name : "info", + code : "INFO" +}; +kony.sync.log.DEBUG = { + value : 5, + name : "debug", + code : "DEBUG" +}; +kony.sync.log.TRACE = { + value : 6, + name : "trace", + code : "TRACE" +}; + +//Global to maintain current loglevel +kony.sync.currentLogLevel = kony.sync.log.ERROR; + + + +sync.log.trace = function (msg, params) { + kony.sync.logger(kony.sync.log.TRACE, msg, params); +}; + +sync.log.debug = function (msg, params) { + kony.sync.logger(kony.sync.log.DEBUG, msg, params); +}; + +sync.log.info = function (msg, params) { + kony.sync.logger(kony.sync.log.INFO, msg, params); +}; + +sync.log.warn = function (msg, params) { + kony.sync.logger(kony.sync.log.WARN, msg, params); +}; + +sync.log.error = function (msg, params) { + kony.sync.logger(kony.sync.log.ERROR, msg, params); +}; + +sync.log.fatal = function (msg, params) { + kony.sync.logger(kony.sync.log.FATAL, msg, params); +}; + + + +kony.sync.logger = function (logLevel, msg, params) { + if (logLevel.value <= kony.sync.currentLogLevel.value) { + params = (typeof(params) === "undefined") ? "" : params; + + //Stringify object + if (kony.sync.isValidJSTable(params)) { + params = JSON.stringify(params, null, " "); + } + + var date = new Date().toLocaleDateString(); + var time = new Date().toLocaleTimeString(); + var level = logLevel.code; + + var formattedMessage = "[KonySync][" + level + "][" + date + "][" + time + "] : " + msg + " " + params; + kony.print(formattedMessage); + } +}; + +sync.log.isDebugEnabled = function () { + return kony.sync.currentLogLevel.value >= kony.sync.log.DEBUG.value; +}; + +sync.log.isTraceEnabled = function () { + return kony.sync.currentLogLevel.value >= kony.sync.log.TRACE.value; +}; + +sync.log.isInfoEnabled = function () { + return kony.sync.currentLogLevel.value >= kony.sync.log.INFO.value; +}; + +sync.log.isWarnEnabled = function () { + return kony.sync.currentLogLevel.value >= kony.sync.log.WARN.value; +}; + +sync.log.isFatalEnabled = function () { + return kony.sync.currentLogLevel.value >= kony.sync.log.FATAL.value; +}; + +sync.log.isErrorEnabled = function () { + return kony.sync.currentLogLevel.value >= kony.sync.log.ERROR.value; +}; + +sync.log.isNoneEnabled = function () { + return kony.sync.currentLogLevel.value === kony.sync.log.NONE.value; +}; + +sync.log.setLogLevel = function (level, logSuccessCallback, logFailureCallback) { + switch (level) { + case kony.sync.log.NONE: + kony.sync.currentLogLevel = kony.sync.log.NONE; + break; + case kony.sync.log.TRACE: + kony.sync.currentLogLevel = kony.sync.log.TRACE; + break; + case kony.sync.log.INFO: + kony.sync.currentLogLevel = kony.sync.log.INFO; + break; + case kony.sync.log.WARN: + kony.sync.currentLogLevel = kony.sync.log.WARN; + break; + case kony.sync.log.ERROR: + kony.sync.currentLogLevel = kony.sync.log.ERROR; + break; + case kony.sync.log.FATAL: + kony.sync.currentLogLevel = kony.sync.log.FATAL; + break; + case kony.sync.log.DEBUG: + kony.sync.currentLogLevel = kony.sync.log.DEBUG; + break; + default : + sync.log.error("Failed in setting log level "+ level); + kony.sync.verifyAndCallClosure(logFailureCallback, "Failed in setting log level " + level); + return; + } + sync.log.info("Log Level successfully set to " + kony.sync.currentLogLevel.name); + kony.sync.verifyAndCallClosure(logSuccessCallback, "Log Level successfully set to " + kony.sync.currentLogLevel.name); +}; + +sync.log.getCurrentLogLevel = function () { + return kony.sync.currentLogLevel; +}; +// **************** End KonySyncLogger.js******************* + + +// **************** Start KonySyncMetadata.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync)=== "undefined"){ + sync = {}; +} + +// gets the time when dbname was last syced +kony.sync.getLastSynctime = function (scopename, dbname, scallback) { + sync.log.trace("Entering kony.sync.getLastSynctime"); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, kony.sync.metaTableName); + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + }, { + key : kony.sync.metaTableFilterValue, + value : "no filter" + } + ]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + kony.sync.single_select_execute(dbname, sql, params, scallback, errorCallback); + + function errorCallback(res){ + sync.log.error("error occurred while getting timestamp since last sync", res); + kony.sync.onDownloadCompletion(true, res); + } +}; + +// gets the time when dbname was last syced +kony.sync.getLastSynctimeForUpload = function (scopename, dbname, scallback){ + sync.log.trace("Entering kony.sync.getLastSynctimeForUpload "); + function callback(rows) { + var lastSyncTime = -1; + var result = ""; + for (var i = 0; i < rows.length; i++) { + var v = rows[i]; + if (v[kony.sync.metaTableSyncTimeColumn] !== "") { + var str = v[kony.sync.metaTableSyncTimeColumn]; + var temp = kony.sync.tonumber(str.split(",")[1]); + if ((lastSyncTime === -1)) { + lastSyncTime = temp; + result = str; + } else if ((temp < lastSyncTime)) { + lastSyncTime = temp; + result = str; + } + } + sync.log.info("Last TimeStamp since Upload :", lastSyncTime); + } + var resulttable = []; + if ((lastSyncTime === -1)) { + resulttable[kony.sync.metaTableSyncTimeColumn] = ""; + scallback([resulttable]); + } else { + resulttable[kony.sync.metaTableSyncTimeColumn] = result; + scallback([resulttable]); + } + } + var query = kony.sync.qb_createQuery(); + + kony.sync.qb_select(query, [kony.sync.metaTableSyncTimeColumn]); + + kony.sync.qb_from(query, kony.sync.metaTableName); + + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + } + ]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + kony.sync.single_select_execute(dbname, sql, params, callback, errorCallback); + + function errorCallback(res){ + sync.log.error("error occurred while getting timestamp since last upload", res); + kony.sync.onUploadCompletion(true, res); + } +}; + +// gets the time when dbname was last synced +kony.sync.getLastSynctimeFilter1 = function (scopename, filter, dbname, scallback) { + sync.log.trace("Entering kony.sync.getLastSynctimeFilter "); + function isDataPresent(result) { + sync.log.info("last sync time in filter :", result); + function getscopeindex(resultcount) { + function calscallback() { + var table = {}; + table[kony.sync.metaTableSyncTimeColumn] = ""; + scallback([table]); + } + var query = kony.sync.qb_createQuery(); + + kony.sync.qb_set(query, { + id : resultcount.length + 1, + filtervalue : filter, + scopename : scopename, + versionnumber : 0, + lastserversynccontext : "", + replaysequencenumber : 0, + lastgeneratedid : -1 + }); + + kony.sync.qb_insert(query, kony.sync.metaTableName); + var query_compile2 = kony.sync.qb_compile(query); + var sql2 = query_compile2[0]; + var params2 = query_compile2[1]; + + kony.sync.single_select_execute(dbname, sql2, params2, calscallback, errorCallback); + } + if (result.length === 1) { + scallback(result); + } else { + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, kony.sync.metaTableName); + var query_compile3 = kony.sync.qb_compile(query); + var sql3 = query_compile3[0]; + var params3 = query_compile3[1]; + + kony.sync.single_select_execute(dbname, sql3, params3, getscopeindex, errorCallback); + } + } + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, [kony.sync.metaTableSyncTimeColumn]); + kony.sync.qb_from(query, kony.sync.metaTableName); + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + }, { + key : kony.sync.metaTableFilterValue, + value : filter + } + ]); + var query_compile1 = kony.sync.qb_compile(query); + var sql1 = query_compile1[0]; + var params1 = query_compile1[1]; + kony.sync.single_select_execute(dbname, sql1, params1, isDataPresent, errorCallback); + + function errorCallback(res){ + sync.log.error("error occurred while getting time-stamp since last upload for filter", res); + kony.sync.onDownloadCompletion(true, res); + } +}; + +/* gets the time when scopename with filter was last synced */ +kony.sync.getLastSynctimeFilter = function (scopename, filter, dbname, callback) { + sync.log.trace("Entering kony.sync.getLastSynctimeFilter "); + var connection = kony.sync.getConnectionOnly(dbname, dbname, transactionErrorCallback); + var isError = false; + var result = []; + if(connection!==null){ + kony.db.transaction(connection, transactionCallback, transactionErrorCallback, transactionSuccessCallback); + } + + function transactionCallback(tx){ + sync.log.trace("Entering kony.sync.getLastSynctimeFilter->transactionCallback"); + //search for row with filter + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, [kony.sync.metaTableSyncTimeColumn]); + kony.sync.qb_from(query, kony.sync.metaTableName); + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + }, { + key : kony.sync.metaTableFilterValue, + value : filter + } + ]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + if (resultSet === false) { + isError = true; + return; + } + if(resultSet.rows.length >= 1){ + result[0] = kony.db.sqlResultsetRowItem(tx, resultSet, 0); + } + else{ //if not found, insert it + //get the count of rows in metainfo + resultSet = kony.sync.executeSql(tx, "select * from " + kony.sync.metaTableName, null); + if (resultSet === false) { + isError = true; + return; + } + + //insert the filter + query = kony.sync.qb_createQuery(); + kony.sync.qb_set(query, { + id : resultSet.rows.length + 1, + filtervalue : filter, + scopename : scopename, + versionnumber : 0, + lastserversynccontext : "", + lastserveruploadsynccontext : "", + replaysequencenumber : 0, + lastgeneratedid : -1 + }); + kony.sync.qb_insert(query, kony.sync.metaTableName); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + resultSet = kony.sync.executeSql(tx, sql, params); + if (resultSet === false) { + isError = true; + return; + } + var table = {}; + table[kony.sync.metaTableSyncTimeColumn] = ""; + result[0] = table; + } + } + + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.getLastSynctimeFilter->transactionSuccessCallback"); + callback(result); + } + + function transactionErrorCallback(){ + sync.log.trace("Entering kony.sync.getLastSynctimeFilter->transactionErrorCallback"); + kony.sync.onDownloadCompletion(true, kony.sync.getTransactionError(isError)); + } + +}; + +// Update the meta tables with last sync time +kony.sync.setLastSyncTime = function (tx, scopename, time, tickcount) { + sync.log.trace("Entering kony.sync.setLastSyncTime "); + var settable = []; + if(kony.sync.schemaUpgradeDownloadPending){ + settable[kony.sync.metaTableSchemaUpgradeSyncTimeColumn] = tickcount; + }else{ + settable[kony.sync.metaTableSyncTimeColumn] = tickcount; + } + var query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, kony.sync.metaTableName); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + }, { + key : kony.sync.metaTableFilterValue, + value : "no filter" + } + ]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; + +// Update the meta tables with last sync time +kony.sync.setLastSyncTimeFilter = function (tx, scopename, filter, time, tickcount) { + sync.log.trace("Entering kony.sync.setLastSyncTimeFilter "); + var settable = []; + if(kony.sync.schemaUpgradeDownloadPending){ + settable[kony.sync.metaTableSchemaUpgradeSyncTimeColumn] = tickcount; + }else{ + settable[kony.sync.metaTableSyncTimeColumn] = tickcount; + } + //settable[kony.sync.metaTableFilterValue] = filter; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, kony.sync.metaTableName); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + }, { + key : kony.sync.metaTableFilterValue, + value : filter + } + ]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; +//function getseqnumber (connection,scopename) +kony.sync.getseqnumber = function (connection, scopename) { + sync.log.trace("Entering kony.sync.getseqnumber "); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, [kony.sync.metaTableSyncVersionCloumn]); + kony.sync.qb_from(query, kony.sync.metaTableName); + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + } + ]); + //local sql = "select "..kony.sync.metaTableSyncVersionCloumn.." from "..kony.sync.metaTableName.." where "..kony.sync.metaTableScopeColumn.." = '"..scopename.."'"; + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(connection, sql, params); + if (resultset === false){ + return false; + } + var rowItem = kony.db.sqlResultsetRowItem(connection, resultset, 0); + return rowItem; +}; + +kony.sync.setSeqnumber = function(scopename, dsname, uploaded, callback) { + sync.log.trace("Entering kony.sync.setSeqnumber "); + var isStatementError = false; + function transactionCallback(tx){ + var settable = []; + settable[kony.sync.metaTableSyncVersionCloumn] = uploaded; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, kony.sync.metaTableName); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, [{ + key: kony.sync.metaTableScopeColumn, + value: scopename + }]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isStatementError = true; + } + } + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.setSeqnumber->transactionSuccessCallback"); + callback(); + } + + function transactionErrorCallback(){ + sync.log.trace("Entering kony.sync.setSeqnumber->transactionErrorCallback"); + sync.log.error("Error occurred while setting sequence number"); + if (!isStatementError) { + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } + else{ + kony.sync.syncUploadFailed(kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + var connection = kony.sync.getConnectionOnly(dsname, dsname, transactionErrorCallback); + if(connection!==null){ + kony.db.transaction(connection, transactionCallback, transactionErrorCallback, transactionSuccessCallback); + } +}; + +kony.sync.getSyncOrder = function (scopename, tx) { + sync.log.trace("Entering kony.sync.getSyncOrder "); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, kony.sync.metaTableName); + + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + } + ]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(tx, sql, params); + if (resultset !== false) { + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + sync.log.debug("sync order value" + rowItem); + if(!kony.sync.isNullOrUndefined(rowItem[kony.sync.metaTableSyncOrderCloumn])) { + return kony.sync.tonumber(rowItem[kony.sync.metaTableSyncOrderCloumn]); + } else { + return null; + } + } else { + return false; + } +}; + +kony.sync.clearSyncHistory = function (dbname, tablename) { + sync.log.trace("Entering kony.sync.clearSyncHistory "); + var sql = "delete from " + tablename + kony.sync.historyTableName; + var wcs = " where konysyncchangetype NOT LIKE '9%'"; + var testsql = sql + wcs; + + kony.sync.single_execute_sql(dbname, testsql, null, null); +}; + +kony.sync.clearSyncOriginal = function (dbname, tbname) { + sync.log.trace("Entering kony.sync.clearSyncOriginal "); + var sql = "delete from " + tbname + kony.sync.originalTableName; + + kony.sync.single_execute_sql(dbname, sql, null, null); +}; + +kony.sync.clearDataForCOE = function(tx, scopename, tablename, wcs, newwcs, changeType, pkset, seqNo, values, isError){ + sync.log.trace("Entering kony.sync.clearDataForCOE "); + if (kony.sync.isNullOrUndefined(pkset) && isError) { + return false; + } + var whereClause = kony.sync.CreateCopy(wcs); + var query = null; + var query_compile = null; + var sql = null; + var params = null; + //hashSum also needs to be updated to avoid conflicts. + var hashSum = values[kony.sync.historyTableHashSumColumn]; + //in case I got client pk from server + if (!kony.sync.isNullOrUndefined(pkset)) { + + //update original table pk with new pk from server + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename + kony.sync.originalTableName); + kony.sync.qb_set(query, pkset); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + return 0; + } + + //update main table pk with new pk from server + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename); + kony.sync.qb_set(query, pkset); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params) === false){ + return 0; + } + + //update history table pk with new pk from server + pkset[kony.sync.historyTableHashSumColumn] = hashSum; + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename + kony.sync.historyTableName); + kony.sync.qb_set(query, pkset); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params) === false){ + return 0; + } + if(isError){ + return false; + } + + kony.sync.serverInsertAckCount = kony.sync.serverInsertAckCount + 1; + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInsertedAck]=kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsInsertedAck]+1; + + whereClause = kony.sync.CreateCopy(newwcs); + } else if (changeType === "update") { + //update history table hashSum for pending records + if(!kony.sync.isNullOrUndefined(hashSum)){ + var updateSet = {}; + updateSet[kony.sync.historyTableHashSumColumn] = hashSum; + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename+kony.sync.historyTableName); + kony.sync.qb_set(query, updateSet); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params) === false){ + return 0; + } + } + /*TODO: non-autogenerated insert ack is currently considered as update ack*/ + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdatedAck] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsUpdatedAck] + 1; + kony.sync.serverUpdateAckCount = kony.sync.serverUpdateAckCount + 1; + } else if (changeType === "delete") { + kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDeletedAck] = kony.sync.objectLevelInfoMap[tablename][kony.sync.numberOfRowsDeletedAck] + 1; + kony.sync.serverDeleteAckCount = kony.sync.serverDeleteAckCount + 1; + } + + if(kony.sync.clearHistoryTable(tx, tablename, whereClause, seqNo)===false){ + return 0; + } + return kony.sync.clearMainTableForRemoveAfterUpload(tx, scopename, tablename, whereClause); + +}; + +kony.sync.clearMainTableForRemoveAfterUpload = function (tx, scopename, tablename, wcs) { + sync.log.trace("Entering kony.sync.clearMainTableForRemoveAfterUpload "); + var whereClause = kony.sync.CreateCopy(wcs); + var removeAfterUpload = kony.sync.checkForDeleteAfterUpload(tablename,scopename); + //Get records to be deleted from history table; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename + kony.sync.historyTableName); + kony.sync.qb_where(query, whereClause); + kony.sync.qb_distinct(query); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet === false){ + return 0; + } + //don't remove from main and original tables if there is pending records in history table + if(resultSet.rows.length!==0){ + return false; + } + + //remove from original table + if(kony.sync.clearOriginalTable(tx,tablename,wcs)===false){ + return 0; + } + + if(removeAfterUpload){ + if(kony.sync.isNullOrUndefined(whereClause)){ + whereClause = []; + } + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, tablename); + kony.sync.qb_where(query, wcs); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + + if(kony.sync.executeSql(tx, sql, params)===false){ + return 0; + } + return true; + } else { + return false; + } +}; + +kony.sync.clearHistoryTable = function (tx, tablename, wcs, seqNo) { + sync.log.trace("Entering kony.sync.clearHistoryTable "); + var whereClause = kony.sync.CreateCopy(wcs); + if(kony.sync.isNullOrUndefined(whereClause)){ + whereClause = []; + } + if (!kony.sync.isNullOrUndefined(seqNo)) { + kony.table.insert(whereClause, { + key : kony.sync.historyTableReplaySequenceColumn, + value : seqNo, + optype : "LT_EQ" + }); + } + kony.table.insert(whereClause, { + key : kony.sync.historyTableChangeTypeColumn, + value : "9%", + optype : "NOT LIKE" + }); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, tablename + kony.sync.historyTableName); + kony.sync.qb_where(query, whereClause); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; + +kony.sync.getRecordsTobeDeletedFromHistoryTable = function(tx, tablename, seqNo){ + sync.log.trace("Entering kony.sync.getRecordsTobeDeletedFromHistoryTable "); + var whereClause = []; + var records = false; + kony.table.insert(whereClause,{ + key: kony.sync.historyTableReplaySequenceColumn, + value: seqNo, + optype: "LT_EQ" + }); + //Get PK columns + var pkColumns = kony.sync.currentScope.syncTableDic[tablename].Pk_Columns; + + //Get records to be deleted from history table; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, pkColumns); + kony.sync.qb_from(query, tablename + kony.sync.historyTableName); + kony.sync.qb_where(query, whereClause); + kony.sync.qb_distinct(query); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet !== false){ + records = []; + var i = 0; + for(;i 0) { + var versionMap = {}; + versionMap[kony.sync.historyTableSyncVersionColumn] = versionNo.versionnumber; + var whereClause = []; + kony.table.insert(whereClause, { + key : kony.sync.historyTableChangeTypeColumn, + value : "9%", + optype : "NOT LIKE" + }); + query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tbname + kony.sync.historyTableName); + kony.sync.qb_set(query, versionMap); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + return; + } + } + } + else{ + isError = true; + return; + } + + } + } + if (recordcount === 0) { + if(kony.sync.updateSyncOrder(tx, scopename)===false){ + isError = true; + return; + } + } + } + function clear_fail() { + //kony.sync.downloadFailed(isError); + if(isError){ + callback(kony.sync.errorCodeSQLStatement); + } + else{ + callback(kony.sync.errorCodeTransaction); + } + } + function clear_success() { + if (callback != null){ + callback(0); + } + } +}; + +//resets sync order for a scope +kony.sync.updateSyncOrder = function (tx, scopename) { + sync.log.trace("Entering kony.sync.updateSyncOrder "); + var settable = {}; + settable[kony.sync.metaTableSyncOrderCloumn] = 0; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, kony.sync.metaTableName); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + } + ]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; + +kony.sync.clearSyncOrder = function(dbname, limit, serverblob, deleteLastUploadRequest, callback) { + sync.log.trace("Entering kony.sync.clearSyncOrder "); + var recordcount = 0; + var isError = false; + + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, clear_fail); + if (dbconnection !== null){ + kony.db.transaction(dbconnection, clear_transaction, clear_fail, clear_success); + } + + function clear_transaction(tx){ + var resultSet = null; + var query_compile = null; + var sql = null; + var params = null; + //updating sync version for all records going in next batch + if(kony.sync.updateSyncOrderForUploadBatching(tx, limit)===false){ + isError = true; + return; + } + //updating upload timestamp + if(kony.sync.setLastSyncUploadContext(tx, kony.sync.currentScope[kony.sync.scopeName], serverblob)===false){ + isError = true; + return; + } + + //delete last upload request + if(kony.sync.deleteLastUploadRequest(tx, kony.sync.currentScope[kony.sync.scopeName])===false){ + isError = true; + return; + } + + //Just returning from here, as this is getting handled in clearDataForCOE function, below code is redundant + return; + + if(kony.sync.isUploadErrorPolicyCOE(kony.sync.currentScope)){ + return; + } + if(!kony.sync.isNullOrUndefined(kony.sync.currentScope.ScopeTables)){ + for (var i = 0; i < kony.sync.currentScope.ScopeTables.length; i++) { + var syncTable = kony.sync.currentScope.ScopeTables[i]; + if(kony.sync.isNullOrUndefined(syncTable)){ + continue; + } + var tbname = syncTable.Name; + + //get whether table is marked for removeAfterUpload + var removeAfterUpload = kony.sync.checkForDeleteAfterUpload(tbname, kony.sync.currentScope[kony.sync.scopeName]); + + //get Records To be deleted From History Table + var records = kony.sync.getRecordsTobeDeletedFromHistoryTable(tx, tbname, limit); + if(records===false){ + isError = true; + return; + } + + //clearing history table + if(kony.sync.clearHistoryTable(tx, tbname, null, limit)===false){ + isError = true; + return; + } + + var pkColumns = kony.sync.currentScope.syncTableDic[tbname].Pk_Columns; + for(var k in records){ + //preparing where clause + var whereClause = []; + for (var j = 0; j < pkColumns.length; j++){ + kony.table.insert(whereClause,{ + key: pkColumns[j], + value: records[k][pkColumns[j]], + optype: "EQ" + }); + } + + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tbname + kony.sync.historyTableName); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet===false){ + isError = true; + return; + } + //delete records from original and main tables if there is no pending record in history table + if(resultSet.rows.length===0){ + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, tbname + kony.sync.originalTableName); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + return; + } + //remove value if table is marked for removeAfterUpload + if(removeAfterUpload){ + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, tbname); + kony.sync.qb_where(query, whereClause); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0]; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + isError = true; + return; + } + } + } + } + //currently disabling removeafterupload for P scope + //kony.sync.clearMainTableForRemoveAfterUpload(tx, scopename, tbname, null); + + //couting deferred uploads + sql = "select * from " + tbname + kony.sync.historyTableName; + resultSet = kony.sync.executeSql(tx, sql, null); + if(resultSet===false){ + isError = true; + return; + } + var num_records = resultSet.rows.length; + recordcount = recordcount + num_records; + } + } + if (recordcount === 0) { + if(kony.sync.updateSyncOrder(tx, kony.sync.currentScope[kony.sync.scopeName])===false){ + isError = true; + } + } + } + + function clear_success(){ + sync.log.trace("Entering kony.sync.clearsyncorder->clear_success"); + callback(); + } + function clear_fail(){ + sync.log.trace("Entering kony.sync.clearsyncorder->clear_fail"); + if (!isError){ + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } + else{ + kony.sync.syncUploadFailed(kony.sync.errorObject); + kony.sync.errorObject = null; + } + } +}; + +kony.sync.setSyncOrder = function (scopename, syncorder, tx, errorCallback) { + sync.log.trace("Entering kony.sync.setSyncOrder "); + var settable = []; + settable[kony.sync.metaTableSyncOrderCloumn] = syncorder; + var query = kony.sync.qb_createQuery(); + + kony.sync.qb_update(query, kony.sync.metaTableName); + + kony.sync.qb_set(query, settable); + + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + } + ]); + //local sql = "update ".. kony.sync.metaTableName.." set "..kony.sync.metaTableSyncOrderCloumn.."="..syncorder .." where "..kony.sync.metaTableScopeColumn.." = '".. scopename .."'"; + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + + sync.log.debug("setting sync order", sql); + return kony.sync.executeSql(tx, sql, params, errorCallback); +}; + +kony.sync.getLastGeneratedID = function (scopename, tx, errorCallback) { + sync.log.trace("Entering kony.sync.getLastGeneratedID "); + var query = kony.sync.qb_createQuery(); + + kony.sync.qb_select(query, [kony.sync.metaTableLastGeneratedId]); + + kony.sync.qb_from(query, kony.sync.metaTableName); + + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + } + ]); + //local sql = "select "..kony.sync.metaTableLastGeneratedId.." from "..kony.sync.metaTableName.." where "..kony.sync.metaTableScopeColumn.." = '"..scopename.."'"; + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + sync.log.debug("getting lastgeneratedid", sql); + var resultset = kony.sync.executeSql(tx, sql, params, errorCallback); + if (resultset === false) { + return false; + } + sync.log.debug("result", resultset); + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + sync.log.debug("rowItem", rowItem); + if (!kony.sync.isNullOrUndefined(rowItem[kony.sync.metaTableLastGeneratedId])) { + return rowItem[kony.sync.metaTableLastGeneratedId]; + } else { + //It should never come here + sync.log.fatal("Last Generated ID is null"); + return false; + } +}; + +kony.sync.setLastGeneratedID = function (scopename, lastgeneratedid, tx, errorCallback) { + sync.log.trace("Entering kony.sync.setLastGeneratedID "); + var settable = []; + settable[kony.sync.metaTableLastGeneratedId] = lastgeneratedid; + var query = kony.sync.qb_createQuery(); + + kony.sync.qb_update(query, kony.sync.metaTableName); + + kony.sync.qb_set(query, settable); + + kony.sync.qb_where(query, [{ + key : kony.sync.metaTableScopeColumn, + value : scopename + } + ]); + //local sql = "update ".. kony.sync.metaTableName.." set "..kony.sync.metaTableLastGeneratedId.."="..lastgeneratedid .." where "..kony.sync.metaTableScopeColumn.." = '".. scopename .."'"; + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + + sync.log.debug("setting sync order", sql); + return kony.sync.executeSql(tx, sql, params, errorCallback); +}; +// **************** End KonySyncMetadata.js******************* + + +// **************** Start KonySyncORMAPI.js******************* +if (typeof(kony.sync) === "undefined") { + kony.sync = {}; +} +if (typeof(sync) === "undefined") { + sync = {}; +} +kony.sync.updateByPK = function (tbname, dbname, relationshipMap, pks, valuestable, successcallback, errorcallback, markForUpload, wcs) { + sync.log.trace("Entering kony.sync.updateByPK -> main function"); + var isSuccess = true; + var pkNotFound = false; + var isRefIntegrityError = false; + var updateResult = null; + var errObject = null; + + var twcs = []; + twcs = kony.sync.CreateCopy(wcs); + function single_execute_sql_transaction(tx) { + sync.log.trace("Entering kony.sync.updateByPK -> single_execute_sql_transaction "); + var record = ""; + if(kony.sync.enableORMValidations){ + record = kony.sync.getOriginalRow(tx, tbname, wcs, errorcallback); + if(record===false){ + isSuccess = false; + return; + } + } + if (null !== record || !kony.sync.enableORMValidations) { + errObject = kony.sync.checkIntegrityinTransaction(tx, relationshipMap); + if (errObject === false) { + isSuccess = false; + return; + } else if (errObject !== true) { + isSuccess = false; + isRefIntegrityError = true; + kony.sync.rollbackTransaction(tx); + return; + } else { + var blobStoreIndices = kony.sync.blobstore_update(tx, tbname, valuestable, wcs, false); + var konysyncBinaryColumn = null; + for(var column in blobStoreIndices) { + konysyncBinaryColumn = kony.sync.binaryMetaColumnPrefix + column; + delete valuestable[column]; + valuestable[konysyncBinaryColumn] = blobStoreIndices[column]; + } + updateResult = kony.sync.update(tx, tbname, valuestable, wcs, markForUpload, errorcallback); + if (updateResult === false) { + isSuccess = false; + } + } + } else { + pkNotFound = true; + } + } + + function single_transactionErrorCallback() { + sync.log.error("Entering kony.sync.updatebyPK->single_transactionErrorCallback "); + if (isSuccess){ + kony.sync.showTransactionError(errorcallback); + } else if(isRefIntegrityError === true){ + kony.sync.verifyAndCallClosure(errorcallback, errObject); + } else { + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + + function single_execute_sql_transactionSucessCallback() { + sync.log.trace("Entering kony.sync.updateByPK->single_execute_sql_transactionSucessCallback -> isSuccess -> " + isSuccess); + if(pkNotFound === true || isSuccess === false){ + kony.sync.pkNotFoundErrCallback(errorcallback,tbname); + return; + } else { + kony.sync.verifyAndCallClosure(successcallback, { + rowsupdated : 1 + }); + } + } + try { + + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback); + if (dbconnection !== null) { + kony.sync.startTransaction(dbconnection, single_execute_sql_transaction, single_execute_sql_transactionSucessCallback, single_transactionErrorCallback, "Single Execute"); + } + } catch (e) { + sync.log.error("Unknown error occurred during update", e); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorUnknown, kony.sync.getErrorMessage(kony.sync.errorUnknown, "Rollback", e), null)); + } +}; + +kony.sync.checkForFalseUpdateInTransaction = function (tx, dbname, tbname, twcs, markForUpload, errorcallback) { + sync.log.trace("Entering kony.sync.checkForFalseUpdate "); + if (kony.sync.getUploadStatus(markForUpload)){ + return true; + } else { + kony.table.insert(twcs, { + key : kony.sync.historyTableChangeTypeColumn, + value : "90", + optype : "EQ", + comptype : "AND" + }); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, [kony.sync.historyTableChangeTypeColumn]); + kony.sync.qb_from(query, tbname + "_history"); + kony.sync.qb_where(query, twcs); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + + var resultSet = kony.sync.executeSql(tx, sql, params, errorcallback); + if ((resultSet !== false)) { + var num_records = resultSet.rows.length; + if (num_records !== 0) { + sync.log.error("Record does not exist on server, mark it for upload before updating/deleting it"); + return kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeMarkForUpload, kony.sync.getErrorMessage(kony.sync.errorCodeMarkForUpload), null)); + } + } else { + return false; + } + return true; + } +}; + +// **************** End KonySyncORMAPI.js******************* + + +// **************** Start konySyncQueryBuilder.js******************* +//-------------------------Sample Query Table for reference---------------------------- +//sqlquery={ +// ["schemaname"] = "", +// ["tablename"]= "", +// ["operationtype"] = "" { Insert, Select, Update, Delete, Custom }, +// ["orderbyclause"]="", +// ["topclause"]="", +// ["isPurge"]=true/false This condition will make insert statement to insert ignore. +// ["purgeValues"] = ""; +// multiple conditions +// ["conditions"]={ +// { +// ["key"]="" +// ["value"]="" +// ["optype"]="" { EQ, NOT_EQ, GT, GT_EQ, LT, LT_EQ, LIKE, JOIN } +// ["comptype"]="" { AND, OR } +// ["binary"]="" {true,false} +// }, +// { +// ["key"]="" +// ["value"]="" +// ["optype"]="" +// ["value"]="" +// } +// }, +// ["fields"]={ +// "c1","c2","c3" +// }, +// ["colvals"]={ +// { +// ["key"]="cname" +// ["value"]="vname" +// }, +// { +// ["key"]="cname" +// ["value"]="vname" +// } +// } +//} +//function qb_createQuery() + +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} +kony.sync.qb_createQuery = function() { + sync.log.trace("Entering kony.sync.qb_createQuery "); + return { + topclause: "", + distinctclause: "", + orderbyclause: "", + colvals: [], + conditions: [], + paramindex: 0 + }; +}; + +kony.sync.qb_where = function(query, conditions) { + sync.log.trace("Entering kony.sync.qb_where "); + if(kony.sync.isNullOrUndefined(conditions)){ + return; + } + for (var i = 0; i < conditions.length; i++) { + var cond = conditions[i]; + var condition = []; + if (kony.sync.isNullOrUndefined(cond.optype)) { + cond.optype = "EQ"; + } + if (kony.sync.isNullOrUndefined(cond.comptype)) { + cond.comptype = "AND"; + } + condition.key = cond.key; + condition.optype = cond.optype; + condition.value = cond.value; + condition.comptype = cond.comptype; + condition.openbrace = cond.openbrace; + condition.closebrace = cond.closebrace; + kony.table.insert(query.conditions, condition); + } +}; + +kony.sync.qb_insert = function(query, tablename) { + sync.log.trace("Entering kony.sync.qb_insert "); + query.operationtype = "insert"; + query.tablename = tablename; +}; + +kony.sync.qb_purgeInsert = function(query, tablename, values){ + sync.log.trace("Entering kony.sync.qb_purgeInsert "); + query.operationtype = "insert"; + query.tablename = tablename; + query.isPurge = true; + if(kony.sync.isNullOrUndefined(kony.sync.queryStore[tablename+"purgeInsert"])){ + kony.sync.qb_set(query, values); + }else{ + query.purgeValues = values; + } +}; + +kony.sync.qb_delete = function(query, tablename) { + sync.log.trace("Entering kony.sync.qb_delete "); + query.operationtype = "delete"; + query.tablename = tablename; +}; + +kony.sync.qb_update = function(query, tablename) { + sync.log.trace("Entering kony.sync.qb_update "); + query.operationtype = "update"; + query.tablename = tablename; +}; + +kony.sync.qb_select = function(query, fields) { + sync.log.trace("Entering kony.sync.qb_select "); + query.operationtype = "select"; + query.fields = fields; +}; + +kony.sync.qb_from = function(query, tablename) { + sync.log.trace("Entering kony.sync.qb_from "); + query.tablename = tablename; +}; + +kony.sync.qb_set = function(query, tabcolval) { + sync.log.trace("Entering kony.sync.qb_set "); + for (var key in tabcolval) { + var value = tabcolval[key]; + if(!kony.sync.isNullOrUndefined(value)) { + var colval = []; + colval.key = key; + colval.value = value; + kony.table.insert(query.colvals, colval); + } + } +}; + +kony.sync.qb_top = function(query, topno) { + sync.log.trace("Entering kony.sync.qb_top "); + query.topclause = " Top " + topno + " "; +}; + +kony.sync.qb_orderBy = function(query,orderByMap) { + sync.log.trace("Entering kony.sync.qb_orderBy "); + var orderByClause = ""; + if(!kony.sync.isNullOrUndefined(orderByMap)){ + orderByClause = " order by "; + var j=0; + for(var i in orderByMap){ + if(j===0) { + orderByClause = orderByClause+ " \"" + orderByMap[i].key +"\""; + j++; + } + else { + orderByClause = orderByClause+",\""+ orderByMap[i].key + "\""; + } + if(orderByMap[i].sortType === "desc"){ + orderByClause = orderByClause + " desc"; + } + } + } + query.orderbyclause = orderByClause; +}; + +kony.sync.qb_distinct = function(query) { + query.distinctclause = " distinct "; +}; + +kony.sync.qb_orderby1 = function(query, colname, isasec) { + sync.log.trace("Entering kony.sync.qb_orderby1 "); + if ((isasec)) { + query.orderbyclause = " order by \"" + colname + "\""; + } else { + query.orderbyclause = " order by \"" + colname + "\" desc "; + } +}; + +kony.sync.qb_createParam = function(pkey, query, pval, params) { + sync.log.trace("Entering kony.sync.qb_createParam "); + if ((kony.sync.getBackEndDBType() === kony.sync.dbTypeSQLLite)) { + kony.table.insert(params, pval); + return "?"; + } else if ((kony.sync.getBackEndDBType() === kony.sync.dbTypeSQLCE)) { + query.paramindex = query.paramindex + 1; + var param = "@" + pkey + query.paramindex; + params[param] = pval; + return param; + } +}; + +kony.sync.qb_getupdatedfields = function(query) { + sync.log.trace("Entering kony.sync.qb_getupdatedfields "); + var updateStr = ""; + for (var i=0; i < query.colvals; i++) { + var v = query.colvals[i]; + if(i === 0){ + updateStr = " set "; + } + if(v.value === "nil") { + updateStr = updateStr + " \"" + v.key + "\"=" + "null"; + } else { + updateStr = updateStr + " \"" + v.key + "\"=" + "'" + v.value + "'"; + } + if (i < query.colvals.length-1) { + updateStr = updateStr + ","; + } + } + return updateStr; +}; + +kony.sync.qb_getparamupdatedfields = function(query) { + sync.log.trace("Entering kony.sync.qb_getparamupdatedfields "); + var updateStr = ""; + var params = []; + for (var i=0; i "; + } + } + } else if ((optype === "GT")) { + return " > "; + } else if ((optype === "GT_EQ")) { + return " >= "; + } else if ((optype === "LT")) { + return " < "; + } else if ((optype === "LT_EQ")) { + return " <= "; + } else if ((optype === "LIKE")) { + return " LIKE "; + } else if ((optype === "NOT LIKE")) { + return " NOT LIKE "; + } else { + return ""; + } + return "MARS"; +}; + +kony.sync.qb_getcompstring = function(comptype) { + sync.log.trace("Entering kony.sync.qb_getcompstring "); + if ((comptype === "AND")) { + return " AND "; + } else if ((comptype === "OR")) { + return " OR "; + } else { + return ""; + } +}; + +kony.sync.qb_getwhereclause = function(query) { + sync.log.trace("Entering kony.sync.qb_getwhereclause "); + var retstr = ""; + if (!kony.sync.isNullOrUndefined(query.conditions)) { + for (var i = 0; i < query.conditions.length; i++) { + var condition = query.conditions[i]; + if (i === 0) { + retstr = " WHERE "; + } + var conditionString = ""; + if ((condition.value === "nil")) { + conditionString = "\"" + condition.key + "\" " + kony.sync.qb_getoperatorString(condition.optype, true) + "null"; + } else { + conditionString = "\"" + condition.key + "\" " + kony.sync.qb_getoperatorString(condition.optype, false) + "'" + condition.value + "' "; + } + if(condition.openbrace === true){ + conditionString = " ( " + conditionString; + } + if(condition.closebrace === true){ + conditionString = conditionString + ")"; + } + retstr = retstr + conditionString; + if (i !== query.conditions.length - 1) { + retstr = retstr + kony.sync.qb_getcompstring(condition.comptype); + } + } + } + return retstr; +}; + +kony.sync.qb_getparamwhereclause = function(query) { + sync.log.trace("Entering kony.sync.qb_getparamwhereclause "); + var retstr = ""; + var params = []; + if (!kony.sync.isNullOrUndefined(query.conditions)) { + for (var i = 0; i < query.conditions.length; i++) { + var condition = query.conditions[i]; + if (i === 0) { + retstr = " WHERE "; + } + var conditionString = ""; + if ((condition.value === "nil")) { + conditionString = condition.key + kony.sync.qb_getoperatorString(condition.optype, true) + "null"; + } else { + var param = kony.sync.qb_createParam(condition.key, query, condition.value, params); + conditionString = condition.key + kony.sync.qb_getoperatorString(condition.optype, false) + param; + } + if(condition.openbrace === true){ + conditionString = " ( " + conditionString; + } + if(condition.closebrace === true){ + conditionString = conditionString + ")"; + } + retstr = retstr + conditionString; + if (i !== query.conditions.length - 1) { + retstr = retstr + kony.sync.qb_getcompstring(condition.comptype); + } + } + } + return [retstr, params]; +}; + +kony.sync.qb_getinsertcolums = function(query) { + sync.log.trace("Entering kony.sync.qb_getinsertcolums "); + var retstr = "("; + var numCols = query.colvals.length; + var count = 0; + if(numCols === 0) { + return ""; + } + if(!kony.sync.isNullOrUndefined(query.colvals)){ + for (var i = 0; i < query.colvals.length; i++) { + var colval = query.colvals[i]; + count = count + 1; + retstr = retstr + "\"" + colval.key + "\""; + if ((count !== numCols)) { + retstr = retstr + ","; + } + } + } + retstr = retstr + ")"; + return retstr; +}; + +kony.sync.qb_getinsertvalues = function(query) { + sync.log.trace("Entering kony.sync.qb_getinsertvalues "); + var retstr = "("; + var numCols = query.colvals.length; + if (numCols === 0) { + return ""; + } + if(!kony.sync.isNullOrUndefined(query.colvals)){ + for (var i = 0; i < query.colvals.length; i++) { + var colval = query.colvals[i]; + var value = ""; + if ((colval === "nil")) { + value = "NULL"; + } else { + value = "'" + colval.value + "'"; + } + retstr = retstr + value; + if ((i !== numCols)) { + retstr = retstr + ","; + } + } + } + retstr = retstr + ")"; + return retstr; +}; + +kony.sync.qb_getparaminsertvalues = function(query) { + sync.log.trace("Entering kony.sync.qb_getparaminsertvalues "); + var retstr = "("; + var params = []; + var numCols = query.colvals.length; + if (numCols === 0) { + return ""; + } + if(!kony.sync.isNullOrUndefined(query.colvals)){ + for (var i = 0; i < query.colvals.length; i++) { + var colval = query.colvals[i]; + var value = ""; + if ((colval === "nil")) { + value = "NULL"; + } else { + var param = kony.sync.qb_createParam(colval.key, query, colval.value, params); + value = param; + } + retstr = retstr + value; + if (i !== numCols - 1) { + retstr = retstr + ","; + } + } + } + retstr = retstr + ")"; + return [retstr, params]; +}; + +kony.sync.qb_gettablename = function(query) { + sync.log.trace("Entering kony.sync.qb_gettablename "); + return query.tablename; +}; + +//lmit and offset for select +kony.sync.qb_limitOffset = function(query, limit, offset){ + if(!kony.sync.isNullOrUndefined(limit)){ + if(kony.sync.isNullOrUndefined(offset)){ + offset = 0; + } + if ((kony.sync.getBackEndDBType() === kony.sync.dbTypeSQLLite)) { + query.limit = limit; + query.offset = offset; + } + } +}; + +kony.sync.qb_compile = function(query) { + sync.log.trace("Entering kony.sync.qb_compile "); + var params = null; + var sql = null; + var wctable = null; + var wc = null; + var ret = null; + if ((kony.sync.isParameter)) { + ret = ""; + if ((query.operationtype === "insert")) { + var insertstring = "insert into "; + if(query.isPurge === true){ + if(!kony.sync.isNullOrUndefined(kony.sync.queryStore[query.tablename+"purgeInsert"])){ + return [kony.sync.queryStore[query.tablename+"purgeInsert"], query.purgeValues]; + } + //#ifdef android + insertstring = "insert into "; + //#else + //#ifdef tabrcandroid + insertstring = "insert into "; + //#else + insertstring = "insert or ignore into "; + //#endif + //#endif + } + var itable = kony.sync.qb_getparaminsertvalues(query); + var iv = itable[0]; + params = itable[1]; + sql = insertstring + "\"" + kony.sync.qb_gettablename(query) + "\"" + kony.sync.qb_getinsertcolums(query) + " values " + iv; + if(query.isPurge === true){ + kony.sync.queryStore[query.tablename+"purgeInsert"] = sql; + } + return [sql, params]; + }else if ((query.operationtype === "select")) { + wctable = kony.sync.qb_getparamwhereclause(query); + wc = wctable[0]; + params = wctable[1]; + sql = "select " + query.distinctclause + query.topclause + kony.sync.qb_getfieldstring(query) + " from \"" + kony.sync.qb_gettablename(query) + "\"" + wc + query.orderbyclause; + if(!kony.sync.isNullOrUndefined(query.limit)){ + sql += " limit " + query.limit + " offset " + query.offset; + } + return [sql, params]; + } else if ((query.operationtype === "update")) { + wctable = kony.sync.qb_getparamwhereclause(query); + wc = wctable[0]; + var wparams = wctable[1]; + var uftable = kony.sync.qb_getparamupdatedfields(query); + var uf = uftable[0]; + var uparams = uftable[1]; + sql = "Update \"" + kony.sync.qb_gettablename(query) + "\" " + uf + " " + wc; + for (var i = 0; i < wparams.length; i++) { + uparams.push(wparams[i]); + } + params = uparams; + //kony.sync.syncPrint("update sql : " + sql); + + //kony.sync.syncPrint("update params : " + params); + return [sql, params]; + } else if ((query.operationtype === "delete")) { + wctable = kony.sync.qb_getparamwhereclause(query); + wc = wctable[0]; + params = wctable[1]; + sql = "delete from \"" + kony.sync.qb_gettablename(query) + "\" " + wc; + return [sql, params]; + } + } else { + ret = ""; + if ((query.operationtype === "select")) { + sql = "select " + query.distinctclause + query.topclause + kony.sync.qb_getfieldstring(query) + + " from \"" + kony.sync.qb_gettablename(query) + "\"" + kony.sync.qb_getwhereclause(query) + query.orderbyclause; + return sql; + } else if ((query.operationtype === "update")) { + return "Update \"" + kony.sync.qb_gettablename(query) + + "\" " + kony.sync.qb_getupdatedfields(query) + + " " + kony.sync.qb_getwhereclause(query); + } else if ((query.operationtype === "insert")) { + return "insert into \"" + kony.sync.qb_gettablename(query) + "\"" + + kony.sync.qb_getinsertcolums(query) + " values " + kony.sync.qb_getinsertvalues(query); + } else if ((query.operationtype === "delete")) { + return "delete from \"" + kony.sync.qb_gettablename(query) + "\" " + kony.sync.qb_getwhereclause(query); + } + } +}; +// **************** End konySyncQueryBuilder.js******************* + + +// **************** Start konySyncQueryProvider.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} + +kony.sync.single_execute_sql = function (dsname, sqlstatement, params, result_successcallback, result_errorcallback) { + sync.log.trace("Entering kony.sync.single_execute_sql-> main function"); + var single_execute_sql_result = null; + var dbname = dsname; + var isError = false; + function single_execute_sql_transaction(tx) { + sync.log.trace("Entering single_execute_sql_transaction"); + var resultset = kony.sync.executeSql(tx, sqlstatement, params, result_errorcallback); + if (resultset !== false) { + if (resultset.rows.length > 0) { + single_execute_sql_result = kony.db.sqlResultsetRowItem(tx, resultset, 0); + } + } else { + isError = true; + } + } + function single_execute_sql_transactionSucessCallback() { + sync.log.trace("Entering kony.sync.single_execute_sql->single_execute_sql_transactionSucessCallback"); + if (!isError) { + kony.sync.verifyAndCallClosure(result_successcallback, single_execute_sql_result); + } + } + + function single_execute_sql_transactionErrorCallback() { + sync.log.error("Entering kony.sync.single_execute_sql->single_execute_sql_transactionErrorCallback"); + if (!isError) { + kony.sync.verifyAndCallClosure(result_errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } + else{ + kony.sync.verifyAndCallClosure(result_errorcallback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname,result_errorcallback); + if(dbconnection!==null){ + kony.sync.startTransaction(dbconnection, single_execute_sql_transaction, single_execute_sql_transactionSucessCallback, single_execute_sql_transactionErrorCallback, "Single Execute"); + } +}; + +kony.sync.single_select_execute = function (dsname, sql, params, success_callback, error_callback) { + sync.log.trace("Entering kony.sync.single_select_execute "); + var callback_result = []; + var dbname = dsname; + var isError = false; + + function single_transaction_success_callback() { + sync.log.trace("Entering kony.sync.single_select_execute->single_transaction_success_callback"); + if (!isError) { + kony.sync.verifyAndCallClosure(success_callback, callback_result); + } + } + + function single_transaction_error_callback() { + sync.log.error("Entering kony.sync.single_select_execute->single_transaction_error_callback"); + if (!isError) { + kony.sync.showTransactionError(error_callback); + }else{ + sync.log.error("Entering kony.sync.single_select_execute->single_transaction_error_callback :", kony.sync.errorObject); + kony.sync.verifyAndCallClosure(error_callback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + + function single_transaction_callback(tx) { + sync.log.trace("Entering kony.sync.single_select_execute->single_transaction_callback"); + var resultSet = kony.sync.executeSql(tx, sql, params, error_callback); + if (resultSet !== false) { + if ((kony.sync.is_SQL_select(sql))) { + var num_records = resultSet.rows.length; + sync.log.debug("Single Select no of records:", num_records); + for (var i = 0; i <= num_records - 1; i++) { + var record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + kony.table.insert(callback_result, record); + } + } + } else { + isError = true; + } + } + + var connection = kony.sync.getConnectionOnly(dbname, dbname, error_callback); + if(connection !== null){ + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback); + } +}; + + +kony.sync.single_binary_select_ondemand_execute = function(dsname, tbname, columnName, pks, config, + blobType, successCallback, errorCallback){ + + var response = {}; + + function single_transaction_success_callback() { + sync.log.trace("Entering kony.sync.single_select_execute_binary_onDemand->single_select_binary_transaction_success"); + } + + function single_transaction_error_callback() { + sync.log.error("Entering kony.sync.single_select_execute_binary_onDemand->single_select_binary_transaction_failed"); + + } + + function single_transaction_callback(tx) { + var scopename = kony.sync.scopes.syncTableScopeDic[tbname]; + var scope = kony.sync.scopes[scopename]; + var pkColumns = scope.syncTableDic[tbname].Pk_Columns; + + //validate whether we get all pks in the pk table. + pks = kony.sync.validatePkTable(pkColumns, pks); + + if(!kony.sync.isNullOrUndefined(pks)) { + + var blobRef = kony.sync.getBlobRef(tx, tbname, columnName, pks ,errorCallback); + if(!kony.sync.isNullOrUndefined(blobRef)) { + if (blobRef === -1) { + //no record exists.. + response.pkTable = pks; + if(blobType === kony.sync.BlobType.BASE64) { + response.base64 = null; + } else { + response.filePath = null; + } + successCallback(response); + + } else if(blobRef === "NULL") { + //trigger download.. + kony.sync.blobManager.getBlobOnDemand(tx, null, blobType, tbname, + columnName, config, pks, successCallback, errorCallback); + } + else { + //fetch from blob store manager. + kony.sync.blobManager.getBlobOnDemand(tx, blobRef, blobType, tbname, + columnName, config, pks, successCallback, errorCallback); + } + } + } else { + //error invalid pks. + kony.print("Invalid pk table.."); + var error = {}; + errorCallback(error); + } + + } + + if(kony.sync.isBinaryColumn(tbname, columnName) !== -1) { + var connection = kony.sync.getConnectionOnly(dsname, dsname, errorCallback); + if(connection !== null){ + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback); + } + } else { + //not a binary column. return empty object. + successCallback(response); + } +}; + +kony.sync.single_binary_select_inline_execute = function(dsname, tbname, columnName, pks, config, blobType, + successCallback, errorCallback) { + var response = {}; + + function single_transaction_success_callback() { + sync.log.trace("Entering kony.sync.single_select_execute_binary_onDemand->single_select_binary_transaction_success"); + } + + function single_transaction_error_callback() { + sync.log.error("Entering kony.sync.single_select_execute_binary_onDemand->single_select_binary_transaction_failed"); + + } + + function single_transaction_callback(tx) { + var scopename = kony.sync.scopes.syncTableScopeDic[tbname]; + var scope = kony.sync.scopes[scopename]; + var pkColumns = scope.syncTableDic[tbname].Pk_Columns; + + //validate whether we get all pks in the pk table. + pks = kony.sync.validatePkTable(pkColumns, pks); + + if(!kony.sync.isNullOrUndefined(pks)) { + var blobRef = kony.sync.getBlobRef(tx, tbname, columnName, pks, errorCallback); + if(!kony.sync.isNullOrUndefined(blobRef)) { + if (blobRef === -1) { + //No record exists with given pks. + response.pkTable = pks; + if(blobType === kony.sync.BlobType.BASE64) { + response.base64 = null; + } else { + response.filePath = null; + } + successCallback(response); + + } else { + //fetch from blob store manager. + kony.sync.blobManager.getBlobInline(tx, blobRef, blobType, tbname, + columnName, config, pks, successCallback, errorCallback); + } + } else { + //blob doesn't exist for given record. + response.pkTable = pks; + if(blobType === kony.sync.BlobType.BASE64) { + response.base64 = null; + } else { + response.filePath = null; + } + successCallback(response); + } + } else { + //error invalid pks. + var error = kony.sync.getErrorTable( + kony.sync.errorCodeInvalidPksGiven, + kony.sync.getErrorMessage(kony.sync.errorCodeInvalidPksGiven) + ); + errorCallback(error); + } + + } + + if(kony.sync.isBinaryColumn(tbname, columnName) !== -1) { + var connection = kony.sync.getConnectionOnly(dsname, dsname, errorCallback); + if(connection !== null){ + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback); + } + } else { + //not a binary column. return empty object. + successCallback(response); + } +}; + +kony.sync.single_binary_select_base64_execute = function(dsname, tbname, columnName, pks, config, + successCallback, errorCallback){ + sync.log.trace("Entering kony.sync.single_binary_select_base64_execute-> main function"); + if(kony.sync.isValidFunctionType(successCallback) && kony.sync.isValidFunctionType(errorCallback)) { + if(columnName === undefined || typeof(columnName) !== "string") { + //TODO: create an appropriate error object + var err = {}; + errorCallback(err); + return; + } + var downloadPolicy = kony.sync.getDownloadPolicy(tbname, columnName); + if(!kony.sync.isNullOrUndefined(downloadPolicy)) { + if(downloadPolicy === "Attachment") { + kony.sync.single_binary_select_ondemand_execute(dsname, tbname, columnName, pks, + config, kony.sync.BlobType.BASE64, successCallback, errorCallback); + } else { + //call inline base64 fetch. + kony.sync.single_binary_select_inline_execute(dsname, tbname, columnName, pks, + config, kony.sync.BlobType.BASE64, successCallback, errorCallback); + } + } else { + //TODO: create an appropriate error object - invalid column. + var err = {}; + errorCallback(err); + return; + } + } else { + //invalid callbacks. return + return; + } +}; + +kony.sync.single_binary_select_file_execute = function(dsname, tbname, columnName, pks, config, + successCallback, errorCallback){ + sync.log.trace("Entering kony.sync.single_binary_select_base64_execute-> main function"); + if(kony.sync.isValidFunctionType(successCallback) && kony.sync.isValidFunctionType(errorCallback)) { + if(columnName === undefined || typeof(columnName) !== "string") { + //TODO: create an appropriate error object + var err = {}; + errorCallback(err); + return; + } + var downloadPolicy = kony.sync.getDownloadPolicy(tbname, columnName); + if(!kony.sync.isNullOrUndefined(downloadPolicy)) { + if(downloadPolicy === "Attachment") { + kony.sync.single_binary_select_ondemand_execute(dsname, tbname, columnName, pks, + config, kony.sync.BlobType.FILE, successCallback, errorCallback); + } else { + //call inline base64 fetch. + kony.sync.single_binary_select_inline_execute(dsname, tbname, columnName, pks, + config, kony.sync.BlobType.FILE, successCallback, errorCallback); + } + } else { + //TODO: create an appropriate error object -- invalid column. + var err = {}; + errorCallback(err); + } + } +}; + + +kony.sync.single_insert_execute = function (dsname, tbname, values, success_callback, error_callback, markForUpload) { + sync.log.trace("Entering kony.sync.single_insert_execute-> main function"); + var callback_result = []; + var dbname = dsname; + var isSuccess = true; + + function single_transaction_success_callback() { + sync.log.trace("Entering kony.sync.single_insert_execute->single_transaction_success_callback"); + if (isSuccess) { + kony.sync.verifyAndCallClosure(success_callback, callback_result); + } + } + + function single_transaction_failure_callback() { + sync.log.error("Entering kony.sync.single_insert_execute->single_transaction_failure_callback"); + if (isSuccess) { + kony.sync.showTransactionError(error_callback); + }else{ + sync.log.error("Entering kony.sync.single_insert_execute->single_transaction_failure_callback : ", kony.sync.errorObject); + kony.sync.verifyAndCallClosure(error_callback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + + + function single_transaction_callback(tx) { + sync.log.trace("Entering kony.sync.single_insert_execute->single_transaction_callback"); + //CallBack_result contains AutoGenerated PK in hash ({id = value}) + var blobStoreIndices = kony.sync.blobstore_insert(tx, tbname, values, error_callback); + var konysyncBinaryColumn = null; + for(var column in blobStoreIndices) { + konysyncBinaryColumn = kony.sync.binaryMetaColumnPrefix + column; + delete values[column]; + values[konysyncBinaryColumn] = blobStoreIndices[column]; + } + callback_result = kony.sync.insert(tx, tbname, values, error_callback, markForUpload); + if (callback_result === false) { + isSuccess = false; + } + } + + var connection = kony.sync.getConnectionOnly(dbname, dbname, error_callback); + if(connection !== null){ + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_failure_callback); + } +}; + +kony.sync.single_update_execute = function (dsname, tbname, values, wc, success_callback, error_callback, isBatch, markForUpload, primaryKey) { + sync.log.trace("Entering kony.sync.single_update_execute "); + var callback_result = {}; + var dbname = dsname; + var isError = false; + + function single_transaction_success_callback() { + sync.log.trace("Entering kony.sync.single_update_execute->single_transaction_success_callback "); + kony.sync.verifyAndCallClosure(success_callback, callback_result); + } + + function single_transaction_error_callback() { + sync.log.error("Entering kony.sync.single_update_execute->single_transaction_error_callback"); + if (!isError) { + kony.sync.showTransactionError(error_callback, "Single Update Execute"); + }else{ + sync.log.error("Entering kony.sync.single_update_execute->single_transaction_error_callback :", kony.sync.errorObject); + kony.sync.verifyAndCallClosure(error_callback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + + function single_transaction_callback(tx){ + sync.log.trace("Entering kony.sync.single_update_execute->single_transaction_callback"); + var blobStoreIndices = kony.sync.blobstore_update(tx, tbname, values, wc, isBatch); + if(!kony.sync.isNullOrUndefined(blobStoreIndices)) { + var konysyncBinaryColumn; + for (var column in blobStoreIndices) { + konysyncBinaryColumn = kony.sync.binaryMetaColumnPrefix + column; + delete values[column]; + values[konysyncBinaryColumn] = blobStoreIndices[column]; + } + if (isBatch === true) { + callback_result = kony.sync.updateBatch(tx, tbname, values, wc, markForUpload, primaryKey); + } else { + callback_result = kony.sync.update(tx, tbname, values, wc, markForUpload); + } + } + if(callback_result===false){ + isError = true; + } + } + + var connection = kony.sync.getConnectionOnly(dbname, dbname, error_callback, "Single Update Execute"); + if(connection !== null){ + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback, "Single Update Execute"); + } +}; + +kony.sync.single_delete_execute = function (dsname, tbname, wc, success_callback, error_callback, isBatch, isLocal, markForUpload) { + sync.log.trace("Entering kony.sync.single_delete_execute-> main function"); + var callback_result = []; + var dbname = dsname; + var isError = false; + + function single_transaction_success_callback() { + sync.log.trace("Entering kony.sync.single_delete_execute->single_transaction_success_callback "); + kony.sync.verifyAndCallClosure(success_callback, callback_result); + } + + function single_transaction_callback(tx) { + sync.log.trace("Entering kony.sync.single_delete_execute->single_transaction_callback"); + var isBlobDeleted = kony.sync.blobstore_delete(tx, tbname, wc, isBatch); + if(isBlobDeleted) { + if (isBatch === true) { + callback_result = kony.sync.deleteBatch(tx, tbname, wc, isLocal, markForUpload, error_callback); + } else { + callback_result = kony.sync.remove(tx, tbname, wc, isLocal, markForUpload, error_callback); + } + } + if(callback_result===false){ + isError = true; + } + } + + function single_transaction_error_callback() { + sync.log.error("Entering kony.sync.single_delete_execute->single_transaction_error_callback"); + if (!isError) { + kony.sync.showTransactionError(error_callback, "Single Update Execute"); + }else{ + sync.log.error("Entering kony.sync.single_delete_execute->single_transaction_error_callback :", kony.sync.errorObject); + kony.sync.verifyAndCallClosure(error_callback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + + var connection = kony.sync.getConnectionOnly(dbname, dbname, error_callback, "Single Delete Execute"); + if(connection !== null){ + kony.sync.startTransaction(connection, single_transaction_callback, single_transaction_success_callback, single_transaction_error_callback, "Single Delete Execute"); + } +}; + +kony.sync.massInsert = function (dsname, tbname, valuesArray, successCallback, errorCallback, markForUpload) { + sync.log.trace("Entering kony.sync.massInsert-> main function"); + var callbackResult = []; + var dbname = dsname; + + function massInsertTransactionSuccessCallback() { + sync.log.trace("Entering kony.sync.massInsert->massInsertTransactionSuccessCallback"); + kony.sync.verifyAndCallClosure(successCallback, callbackResult); + } + + function massInsertTransactionErrorCallback() { + sync.log.error("Entering kony.sync.massInsert->massInsertTransactionErrorCallback"); + kony.sync.verifyAndCallClosure(errorCallback, kony.sync.errorObject); + + } + + function massInsertTransactionCallback(tx) { + sync.log.trace("Entering kony.sync.massInsert->massInsertTransactionCallback"); + //CallBack_result contains AutoGenerated PK in hash ({id = value}) + for (var i in valuesArray) { + callbackResult.push(kony.sync.insert(tx, tbname, valuesArray[i], null, markForUpload)); + } + } + + var connection = kony.sync.getConnectionOnly(dbname, dbname); + kony.sync.startTransaction(connection, massInsertTransactionCallback, massInsertTransactionSuccessCallback, massInsertTransactionErrorCallback); +}; + +kony.sync.massUpdate = function(dbname, tbname, inputArray, successCallback, errorCallback, markForUpload, primaryKey) { + sync.log.trace("Entering kony.sync.massUpdate"); + var callbackResultTemp; + var callbackResult = 0; + var isError = false; + var connection = kony.sync.getConnectionOnly(dbname, dbname, errorCallback); + if(connection !== null){ + kony.sync.startTransaction(connection, transactioncallback, transactionSuccessCallback, transactionErrorCallback); + } + + function transactionSuccessCallback() { + sync.log.trace("Entering kony.sync.massUpdate-> transactionSuccessCallback"); + if(!isError){ + kony.sync.verifyAndCallClosure(successCallback, {rowsUpdated:callbackResult}); + } + } + + function transactioncallback(tx) { + sync.log.trace("Entering kony.sync.massUpdate-> transactioncallback"); + for(var i in inputArray){ + callbackResultTemp = kony.sync.updateBatch(tx, tbname, inputArray[i].changeSet, inputArray[i].whereClause, markForUpload, primaryKey); + if(callbackResultTemp === false){ + isError = true; + return; + } + callbackResult += callbackResultTemp.rowsupdated; + } + } + + function transactionErrorCallback() { + if (!isError) { + kony.sync.showTransactionError(errorCallback, "Sync Mass Update"); + }else{ + sync.log.error("Entering kony.sync.massUpdate->transactionErrorCallback :", kony.sync.errorObject); + kony.sync.verifyAndCallClosure(errorCallback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } +}; + +/*This method will open a transaction and then executes the array of queries*/ +kony.sync.executeQueries = function(queries, callback){ + sync.log.trace("Entering kony.sync.executeQueries"); + if(kony.sync.isNullOrUndefined(queries)){ + kony.sync.verifyAndCallClosure(callback, true); + return; + } + var dbname = kony.sync.scopes[0][kony.sync.scopeDataSource]; + var connection = kony.sync.getConnectionOnly(dbname, dbname); + var isError = false; + if(connection !== null){ + kony.sync.startTransaction(connection, transactioncallback, transactionSuccessCallback, transactionErrorCallback); + } + + function transactioncallback(tx){ + for(var i=0; i main function"); + var dbname = kony.sync.scopes[0][kony.sync.scopeDataSource]; + var connection = kony.sync.getConnectionOnly(dbname, dbname); + var resultItems = []; + var isError = false; + + if (connection !== null) { + kony.sync.startTransaction(connection, executeSelectQueryTransactionCallback, executeSelectQuerySuccessCallback, executeSelectQueryErrorCallback); + } + + function executeSelectQueryTransactionCallback(tx) { + sync.log.trace("Entering sync.executeSelectQuery -> transaction callback"); + var resultSet = kony.sync.executeSql(tx, query, null); + if (resultSet === false) { + isError = true; + return; + } + for (var i = 0; i < resultSet.rows.length; i++) { + resultItems[i] = kony.db.sqlResultsetRowItem(tx, resultSet, i); + } + } + + function executeSelectQuerySuccessCallback() { + sync.log.trace("Entering sync.executeSelectQuery -> success callback"); + kony.sync.verifyAndCallClosure(successcallback, resultItems); + } + + function executeSelectQueryErrorCallback() { + sync.log.trace("Entering sync.executeSelectQuery -> error callback"); + kony.sync.callTransactionError(isError, errorcallback); + } +}; +// **************** End konySyncQueryProvider.js******************* +// **************** End konySyncQueryProvider.js******************* + + +// **************** Start KonySyncReset.js******************* +if (typeof(kony.sync) === "undefined") { + kony.sync = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} + +kony.sync.scopeReset = function (scopename, successcallback, failurecallback) { + sync.log.trace("Entering kony.sync.scopeReset->main function"); + var currentScope = kony.sync.scopes[scopename]; + + var dbname = kony.sync.getDBName(); + var isStatementError = false; + var exceptionMessage = null; + + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, failurecallback); + if(dbconnection!==null){ + kony.sync.startTransaction(dbconnection, ScopeResetTransaction, ScopeResetSuccess, ScopeResetFailure); + } + + function ScopeResetTransaction(tx) { + sync.log.trace("Entering kony.sync.scopeReset->transaction function"); + try{ + if(!kony.sync.isNullOrUndefined(currentScope.ScopeTables)){ + for (var i = 0; i < currentScope.ScopeTables.length; i++) { + var syncTable = currentScope.ScopeTables[i]; + var tbname = syncTable.Name; + if (!kony.sync.deleteTable(tx, tbname)) { + isStatementError = true; + break; + } + } + } + } + catch(e){ + exceptionMessage = e; + throw(""); + } + + if (!kony.sync.resetMetaTableForScope(tx, scopename)) { + isStatementError = true; + } + + } + + function ScopeResetSuccess() { + sync.log.trace("Entering kony.sync.scopeReset->success callback function"); + kony.sync.verifyAndCallClosure(successcallback, "Scope Reset Successful"); + } + + function ScopeResetFailure() { + sync.log.error("Entering kony.sync.scopeReset->failure callback function"); + if (isStatementError) { + kony.sync.verifyAndCallClosure(failurecallback, kony.sync.errorObject); + kony.sync.errorObject = null; + } else { + if(exceptionMessage !== null){ + kony.sync.verifyAndCallClosure(failurecallback, kony.sync.getErrorTable(kony.sync.errorUnknown, kony.sync.getErrorMessage(kony.sync.errorUnknown,"Scope Reset",exceptionMessage),null)); + } + else{ + kony.sync.showTransactionError(failurecallback, "Scope Reset"); + } + + } + } +}; + +kony.sync.deleteTable = function (tx, tbname) { + sync.log.trace("Entering kony.sync.deleteTable function"); + if (kony.sync.deleteTableHelper(tx, tbname + kony.sync.historyTableName) === false) { + return false; + } + if (kony.sync.deleteTableHelper(tx, tbname + kony.sync.originalTableName) === false) { + return false; + } + + if (kony.sync.deleteTableHelper(tx, tbname) === false) { + return false; + } + + return true; +}; + +kony.sync.deleteTableHelper = function (tx, tbname) { + sync.log.trace("Entering kony.sync.deleteTableHelper function"); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, tbname); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; + +kony.sync.resetMetaTableForScope = function (tx, scopeName) { + sync.log.trace("Entering kony.sync.resetMetaTableForScope function"); + var query = kony.sync.qb_createQuery(); + var wcs = []; + kony.sync.qb_set(query, { + versionnumber : 0, + lastserversynccontext : "", + replaysequencenumber : 0, + lastgeneratedid : -1 + }); + + kony.table.insert(wcs, { + key : kony.sync.metaTableScopeColumn, + value : scopeName, + optype : "EQ" + }); + + kony.sync.qb_where(query, wcs); + kony.sync.qb_update(query, kony.sync.metaTableName); + //local sql = "insert into "..kony.sync.metaTableName.." (id,scopename,versionnumber,lastserversynccontext,replaysequencenumber,lastgeneratedid) values ('"..id.."','"..scope.ScopeName.."','0','','0','-1')" + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + return kony.sync.executeSql(tx, sql, params); +}; +// **************** End KonySyncReset.js******************* + + +// **************** Start KonySyncRetryHelper.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync)=== "undefined"){ + sync = {}; +} + +//Repetitively calls a service until number of attempts +kony.sync.retryServiceCall = function(url, result, infoObj, retryCount, callback, params){ + sync.log.trace("Entering kony.sync.retryServiceCall"); + sync.log.error("Error while hitting " + url + " : ", result); + sync.log.info("Retrying[" + retryCount + " retries left] ...."); + if(kony.sync.isSyncStopped){ + kony.sync.stopSyncSession(); + return; + } + var params1 = kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onRetry], {"request":params, "errorResponse":result, "retryCount":(kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]-retryCount)}); + if(!kony.sync.isNull(params1)){ + params = params1; + } + var retryWait = 1; //default retry time is 1 second + if (!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.retryWaitKey])) { + retryWait = kony.sync.tonumber(kony.sync.currentSyncConfigParams[kony.sync.retryWaitKey]); + } + if(!kony.sync.isAppInBackground){ + kony.timer.schedule("syncRetryTimer", retryTimerCallback, retryWait, false); + }else{ + retryTimerCallback(); + } + + function downloadNetworkCallbackStatus(status, callResult, info){ + if(status === 400){ + sync.log.trace("Entering kony.sync.retryServiceCall->downloadNetworkCallbackStatus"); + if(retryCount > 0 && kony.sync.checkForRetryErrorCodes(callResult.opstatus)){ + retryCount--; + kony.sync.retryServiceCall(url, callResult, info, retryCount, callback, params); + } + else{ + callback(callResult, info, retryCount); + } + }else if(status === 300){ + callback(kony.sync.getNetworkCancelError(),info,retryCount); + } + } + + function retryTimerCallback() { + sync.log.trace("Entering kony.sync.retryServiceCall->retryTimerCallback"); + kony.sync.invokeServiceAsync(url, params, downloadNetworkCallbackStatus, infoObj); + } +}; + +//Checks whether an error code is eligible for retry or not +kony.sync.checkForRetryErrorCodes = function(key){ + sync.log.trace("Entering kony.sync.checkForRetryErrorCodes"); + //#ifdef KONYSYNC_IOS + var deviceInfo = kony.os.deviceInfo(); + if(deviceInfo.osversion < 7){ + if(!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.retryErrorCodes])){ + return kony.sync.contains(kony.sync.currentSyncConfigParams[kony.sync.retryErrorCodes], key); + } + else{ + return kony.sync.contains([1000, 1013, 1014, 1015], key); + } + }else{ + return key === 1012; + } + //#else + if(!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.retryErrorCodes])){ + return kony.sync.contains(kony.sync.currentSyncConfigParams[kony.sync.retryErrorCodes], key); + } + else{ + return kony.sync.contains([1000, 1013, 1014, 1015], key); + } + //#endif +}; + +kony.sync.eligibleForRetry = function(opstatus, info){ + sync.log.trace("Entering kony.sync.eligibleForRetry"); + return !kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]) && + info > 0 && kony.sync.checkForRetryErrorCodes(opstatus); +}; +// **************** End KonySyncRetryHelper.js******************* + + +// **************** Start KonySyncRollBack.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} + +kony.sync.konySyncRollBackPendingChanges = function(tbname, dbname, wcs, successcallback, errorcallback, isGlobal, count) { + sync.log.trace("Entering kony.sync.konySyncRollBackPendingChanges-> main function"); + var isSuccess = true; + var totalRows = 0; + var pkNotFound = false; + var isStatementError = false; + function single_execute_sql_transaction(tx) { + sync.log.trace("Entering kony.sync.konySyncRollBackPendingChanges->single_execute_sql_transaction "); + if (isGlobal === true) { + totalRows = kony.sync.konySyncRollBackGlobal(tx, errorcallback); + isSuccess = totalRows===false?false:true; + } else if (!kony.sync.isNullOrUndefined(wcs)) { + totalRows = kony.sync.konySyncRollBackRow(tx, tbname, wcs, errorcallback); + if(totalRows===null){ + pkNotFound = true; + isSuccess = false; + } + else if(totalRows===false){ + isStatementError = true; + isSuccess = false; + } + else{ + isSuccess = true; + totalRows = 1; + } + } else { + totalRows = kony.sync.konySyncRollBackTable(tx, tbname, errorcallback); + isSuccess = totalRows===false?false:true; + } + } + + function single_transactionErrorCallback(){ + sync.log.error("Entering kony.sync.konySyncRollBackPendingChanges->single_transactionErrorCallback "); + if(isSuccess){ + kony.sync.showTransactionError(errorcallback); + }else{ + sync.log.error("Entering kony.sync.konySyncRollBackPendingChanges->single_transactionErrorCallback : ", kony.sync.errorObject); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + function single_execute_sql_transactionSucessCallback() { + sync.log.trace("Entering kony.sync.konySyncRollBackPendingChanges->single_execute_sql_transactionSucessCallback "); + if(pkNotFound === true){ + kony.sync.verifyAndCallClosure(errorcallback); + return; + } + + if (isGlobal === true) { + if(kony.sync.isNull(count)){ + count = 0; + } + count+=totalRows; + if (kony.sync.rollbackCurrentScope.Index === kony.sync.scopes.scopecount - 1) { + kony.sync.verifyAndCallClosure(successcallback,{rowsrolledback:count}); + } else { + kony.sync.rollbackCurrentScope = kony.sync.scopes[kony.sync.rollbackCurrentScope.Index + 1]; + kony.sync.konySyncRollBackPendingChanges(null, null, null, successcallback, errorcallback, true, count); + } + } else { + kony.sync.verifyAndCallClosure(successcallback,{rowsrolledback:totalRows}); + } + } + try{ + if (isGlobal === true) { + if (kony.sync.isNullOrUndefined(kony.sync.rollbackCurrentScope)) { + kony.sync.rollbackCurrentScope = kony.sync.scopes[0]; + sync.log.info("RollBacking Global with Scope name : " + kony.sync.rollbackCurrentScope[kony.sync.scopeName] + " and with DBName : " + kony.sync.rollbackCurrentScope[kony.sync.scopeDataSource]); + } + dbname = kony.sync.rollbackCurrentScope[kony.sync.scopeDataSource]; + } + + var dbconnection = kony.sync.getConnectionOnly(dbname, dbname, errorcallback); + if(dbconnection !== null){ + kony.sync.startTransaction(dbconnection, single_execute_sql_transaction, single_execute_sql_transactionSucessCallback, single_transactionErrorCallback, "Single Execute"); + } + } + catch(e) { + sync.log.error("Unknown error occurred during rollback", e); + kony.sync.verifyAndCallClosure(errorcallback,kony.sync.getErrorTable(kony.sync.errorUnknown, kony.sync.getErrorMessage(kony.sync.errorUnknown,"Rollback",e),null)); + } +}; + +kony.sync.konySyncRollBackTable = function(tx, tbname, errorcallback) { + sync.log.trace("Entering kony.sync.konySyncRollBackTable"); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tbname + kony.sync.originalTableName); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultset = kony.sync.executeSql(tx, sql, params, errorcallback); + if(resultset === false){ + return false; + } + var num_records = resultset.rows.length; + sync.log.debug("Number of records to rollback in " + tbname + "=" + num_records); + for (var i = 0; i <= num_records - 1; i++) { + var record = kony.db.sqlResultsetRowItem(tx, resultset, i); + var tableinfo = kony.sync.getTableInfo(tbname); + var wcs = []; + if(!kony.sync.isNullOrUndefined(tableinfo.Pk_Columns)){ + for (var j = 0; j < tableinfo.Pk_Columns.length; j++) { + var pk = tableinfo.Pk_Columns[j]; + var wc = []; + wc.key = pk; + wc.value = record[pk]; + kony.table.insert(wcs, wc); + } + } + sync.log.debug("Rollbacking Record with Primary Key :", wcs); + if(!kony.sync.konysyncRollBackOriginal(tx, tbname, record, wcs, errorcallback)){ + return false; + } + } + return num_records; +}; + +kony.sync.konySyncRollBackGlobal = function(tx) { + sync.log.trace("Entering kony.sync.konySyncRollBackGlobal"); + var noOfScopes = kony.sync.scopes.length; + for(var i=0; i '' and " + kony.sync.metaTableSyncTimeColumn + " is not null" ; + if (kony.sync.executeSql(tx, sql, null) === false) { + isError = true; + return; + } + } + + function transactionSuccessCallback() { + kony.sync.configVersion = appVersion; + kony.sync.currentSyncConfigParams.appVersion = kony.sync.configVersion; + callback(false); + } + + function transactionErrorCallback() { + callback(true, kony.sync.getTransactionError(isError)); + } +}; + +/*This function marks download of data after schema upgrade complete for that particular scope*/ +kony.sync.setSchemaUpgradeDownloadComplete = function (tx, scopename) { + if (kony.sync.schemaUpgradeDownloadPending) { + var sql = "update " + kony.sync.metaTableName + " set " + kony.sync.metaTableSchemaUpgradeSyncTimeColumn + " = '' where " + kony.sync.metaTableScopeColumn + " = '" + scopename + "'"; + if (kony.sync.executeSql(tx, sql, null) === false) { + return false; + } + } + return true; +}; + +/*This method checks if download for schema upgrade is pending for any of the scopes*/ +kony.sync.isDownloadPendingForSchemaUpgrade = function (callback) { + sync.log.trace("Entering kony.sync.isDownloadPendingForSchemaUpgrade"); + var dbname = kony.sync.scopes[0][kony.sync.scopeDataSource]; + var connection = kony.sync.getConnectionOnly(dbname, dbname); + var isError = false; + var pendingDownload = false; + if (connection !== null) { + kony.sync.startTransaction(connection, transactioncallback, transactionSuccessCallback, transactionErrorCallback); + } + + function transactioncallback(tx) { + var sql = "select count(*) from " + kony.sync.metaTableName + " where " + kony.sync.metaTableSchemaUpgradeSyncTimeColumn + " = '0,0'"; + var resultset = kony.sync.executeSql(tx, sql, null); + if (resultset === false) { + isError = true; + return; + } + + var rowCount = kony.db.sqlResultsetRowItem(tx, resultset, 0); + if (rowCount["count(*)"] > 0) { + pendingDownload = true; + } + + sql = "select * from " + kony.sync.syncConfigurationTableName; + resultset = kony.sync.executeSql(tx, sql, null); + if (resultset === false) { + isError = true; + return; + } + var rowitem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + kony.sync.schemaUpgradeContext = rowitem[kony.sync.syncConfigurationColumnSchemaUpgradeContext]; + kony.sync.configVersion = rowitem[kony.sync.syncConfigurationColumnVersion]; + } + + function transactionSuccessCallback() { + callback(false, null, pendingDownload); + } + + function transactionErrorCallback() { + kony.sync.verifyAndCallClosure(callback, true, kony.sync.getTransactionError(isError)); + } +}; + +sync.performUpgrade = function (config) { + sync.log.trace("Entering kony.sync.performUpgrade"); + if (kony.sync.validateSyncConfigParams("performUpgrade", config) === false) { + return; + } + kony.sync.verifyAndCallClosure(config[kony.sync.onPerformUpgradeStartKey]); + config[kony.sync.onSyncError] = config[kony.sync.onPerformUpgradeErrorKey]; + config[kony.sync.onSyncSuccess] = config[kony.sync.onPerformUpgradeSuccessKey]; + + if (kony.sync.preProcessSyncConfig("performUpgrade", config, config[kony.sync.onSyncError]) === false) { + return; + } + kony.sync.isDownloadPendingForSchemaUpgrade(isDownloadPendingForSchemaUpgradeCallback); + function isDownloadPendingForSchemaUpgradeCallback(isError, errorObject, pending) { + if (isError) { + kony.sync.isSessionInProgress = false; // closing the session + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onSyncError], errorObject); + } else { + kony.sync.performOnlySchemaUpgrade = true; + if (pending) { + kony.sync.omitUpload = true; //only download + kony.sync.schemaUpgradeDownloadPending = true; + kony.sync.syncStartSession(); //download pending for already done schema upgrade + } else { + kony.sync.upgradeSchema(upgradeSchemaCallback); //download the scripts and upgrade + } + } + } + + function upgradeSchemaCallback(upgrade){ + if(upgrade){ + kony.sync.syncStartSession(); //download initial data for new columns + }else{ + kony.sync.isSessionInProgress = false; // closing the session + kony.sync.currentSyncReturnParams.upgradeRequired = false; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onPerformUpgradeSuccessKey], kony.sync.currentSyncReturnParams); + delete kony.sync.currentSyncReturnParams.upgradeRequired; + } + } +}; + +sync.isUpgradeRequired = function (config) { + sync.log.trace("Entering kony.sync.isUpgradeRequired"); + if (kony.sync.validateSyncConfigParams("isUpgradeRequired", config) === false) { + return; + } + if (kony.sync.preProcessSyncConfig("isUpgradeRequired", config, config[kony.sync.onIsUpgradeRequiredErrorKey], false) === false) { + return; + } + kony.sync.areSyncConfigVersionDifferent(areSyncConfigVersionDifferentCallback); + function areSyncConfigVersionDifferentCallback(isError, errorObject, isDifferent) { + if (isError) { + kony.sync.verifyAndCallClosure(config[kony.sync.onIsUpgradeRequiredErrorKey], errorObject); + } else { + if (isDifferent) { + kony.sync.verifyAndCallClosure(config[kony.sync.onIsUpgradeRequiredSuccessKey], { + upgradeRequired : true + }); + } else { + config[kony.sync.onUpgradeQueriesDownloadStartKey] = config[kony.sync.onIsUpgradeRequiredStartKey]; + kony.sync.callSchemaUpgradeService(schemaUpgradeCallback, false); + } + } + } + + function schemaUpgradeCallback(serverResponse) { + if (!kony.sync.isNullOrUndefined(serverResponse.opstatus) && serverResponse.opstatus !== 0) { + sync.log.error("Schema Upgrade Response : ", serverResponse); + if (!kony.sync.isNullOrUndefined(serverResponse.d)) { + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onIsUpgradeRequiredErrorKey], kony.sync.getServerError( + serverResponse.d)); + } else { + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onIsUpgradeRequiredErrorKey], kony.sync.getServerError(serverResponse)); + } + return; + } + else if(kony.sync.isNullOrUndefined(serverResponse.d)){ + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onIsUpgradeRequiredErrorKey], kony.sync.getServerError(serverResponse)); + return; + } + if (serverResponse.d.error === "true") { + sync.log.error("Schema Upgrade Response : ", serverResponse); + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onIsUpgradeRequiredErrorKey], kony.sync.getServerError( + serverResponse.d)); + return; + } + var returnParams = {}; + kony.sync.addServerDetails(returnParams, serverResponse); + returnParams.upgradeRequired = serverResponse.d.upgradeavailable === "true" ? true : false; + kony.sync.verifyAndCallClosure(config[kony.sync.onIsUpgradeRequiredSuccessKey], returnParams); + } + +}; + +kony.sync.areSyncConfigVersionDifferent = function (callback) { + var dbname = kony.sync.scopes[0][kony.sync.scopeDataSource]; + var connection = kony.sync.getConnectionOnly(dbname, dbname); + var isError = false; + var isDifferent = false; + if (connection !== null) { + kony.sync.startTransaction(connection, transactioncallback, transactionSuccessCallback, transactionErrorCallback); + } + + function transactioncallback(tx) { + var sql = "select * from " + kony.sync.syncConfigurationTableName; + var resultset = kony.sync.executeSql(tx, sql, null); + if (resultset === false) { + isError = true; + return; + } + var dbSyncConfigVersion = kony.db.sqlResultsetRowItem(tx, resultset, 0)[kony.sync.syncConfigurationColumnVersion]; + if (dbSyncConfigVersion !== konysyncClientSyncConfig.Version) { + isDifferent = true; + } + } + + function transactionSuccessCallback() { + callback(false, null, isDifferent); + } + + function transactionErrorCallback() { + callback(true, kony.sync.getTransactionError(isError)); + } +}; + +kony.sync.isSchemaUpgradeTimeStampEmpty = function(val){ + if(val==="" || val==="0,0" || kony.sync.isNullOrUndefined(val)){ + return true; + }else{ + return false; + } +}; +// **************** End KonySyncSchemaUpgrade.js******************* + + +// **************** Start konySyncServiceProvider.js******************* +if (typeof(kony.sync) === "undefined") { + kony.sync = {}; +} +if (typeof(sync) === "undefined") { + sync = {}; +} + +kony.sync.konyDownloadChanges = function(serverblob, scope, downloadNetworkCallback, isInitialized, schemaUpgradeServerblob) { + sync.log.trace("Entering kony.sync.konyDownloadChanges "); + if (kony.sync.isSyncStopped) { + kony.sync.stopSyncSession(); + return; + } + var retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + + function downloadNetworkCallbackStatus(status, result) { + if (status === 400) { + sync.log.trace("Entering kony.sync.konyDownloadChanges->downloadNetworkCallbackStatus"); + if (kony.sync.eligibleForRetry(result.opstatus, retries)) { + retries--; + kony.sync.retryServiceCall(kony.sync.getDownloadURL(), result, null, retries, checkForChunking, params); + } else { + if (kony.sync.eligibleForChunking(result)) { + kony.sync.startChunking(kony.sync.getChunkDownloadURL(), params, result, downloadNetworkCallback); + } else { + kony.sync.setSessionID(result); + downloadNetworkCallback(result); + } + } + } else if (status === 300) { + downloadNetworkCallback(kony.sync.getNetworkCancelError()); + } + } + + function checkForChunking(result, info, retry) { + sync.log.trace("Entering kony.sync.konyDownloadChanges->checkForChunking"); + retries = retry; + downloadNetworkCallbackStatus(400, result, info); + } + + if (kony.sync.isNullOrUndefined(serverblob)) { + serverblob = ""; + } + + var params = {}; + + //check for pending chunks + kony.sync.checkForChunkingBeforeDownload(serverblob, normaldownloadCallback, downloadNetworkCallback, schemaUpgradeServerblob); + + function normaldownloadCallback(payloadId) { + sync.log.trace("Entering kony.sync.konyDownloadChanges->normaldownloadCallback"); + var jsonContext = null; + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncScopeFilter)) { + var scopejsonfilter = { + "d": { + Filters: kony.sync.currentSyncScopeFilter + } + }; + jsonContext = JSON.stringify(scopejsonfilter); + } + if (isInitialized === false) { + kony.sync.downloadClientContext.InitialSync = "true"; + } else { + delete kony.sync.downloadClientContext.InitialSync; + } + params.clientcontext = kony.sync.downloadClientContext; + kony.sync.commonServiceParams(params); + params.context = jsonContext; + params.enablebatching = "true"; + params.batchsize = kony.sync.getBatchSize(); + if (kony.sync.schemaUpgradeDownloadPending) { + params.tickcount = schemaUpgradeServerblob; + params.uppertickcount = serverblob; + if (!kony.sync.isNullOrUndefined(kony.sync.schemaUpgradeContext)) { + params.upgradecontext = kony.sync.schemaUpgradeContext; + } + } else { + params.tickcount = serverblob; + } + params.scopename = kony.sync.currentScope[kony.sync.scopeName]; + params.strategy = kony.sync.currentScope[kony.sync.syncStrategy]; + params.instanceid = kony.sync.getInstanceID(); + params.clientid = kony.sync.getDeviceID(); + params.appVersion = kony.sync.currentSyncConfigParams.appVersion; + params[kony.sync.chunkSizeKey] = kony.sync.getChunkSize(); + + //include payloadid if it is not null + if (!kony.sync.isNull(payloadId)) { + params.deletechunkpayloadid = payloadId; + } + + if (!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey])) { + params.httpconfig = { + timeout: kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey] + }; + } + + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks]) && + !kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][kony.sync.currentScope[kony.sync.scopeName]])) { + params[kony.sync.sessionTaskUploadErrorPolicy] = kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][kony.sync.currentScope[kony.sync.scopeName]][kony.sync.sessionTaskUploadErrorPolicy]; + } + + var paramsToSend = null; + var currentSyncReturnParamsTemp = kony.sync.currentSyncReturnParams; + currentSyncReturnParamsTemp.downloadRequest = params; + kony.sync.deleteMapKey(currentSyncReturnParamsTemp, kony.sync.serverDetails); + if (kony.sync.globalIsDownloadStarted) { + paramsToSend = kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onDownloadStart], currentSyncReturnParamsTemp); + kony.sync.globalIsDownloadStarted = false; + if (!kony.sync.isNullOrUndefined(paramsToSend)) { + params = paramsToSend; + kony.sync.downloadClientContext = params.clientcontext; + } + } + currentSyncReturnParamsTemp.downloadRequest = params; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onBatchProcessingStart], kony.sync.currentSyncReturnParams); + if (paramsToSend != null) { + params = paramsToSend; + kony.sync.downloadClientContext = params.clientcontext; + } + + currentSyncReturnParamsTemp = null; + paramsToSend = null; + params.clientcontext = JSON.stringify(kony.sync.downloadClientContext); + + sync.log.info("Hitting the service with URL " + kony.sync.getDownloadURL(), params); + kony.sync.invokeServiceAsync(kony.sync.getDownloadURL(), params, downloadNetworkCallbackStatus, null); + } +}; + +kony.sync.konyUploadChanges = function(changes, uploadNetworkcallback, lastBatch, lastjson) { + sync.log.trace("Entering kony.sync.konyUploadChanges"); + if (kony.sync.isSyncStopped) { + kony.sync.stopSyncSession(); + return; + } + var results1 = []; + var retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + var jsonLua = null; + var json = null; + + function uploadNetworkCallbackStatus(status, result, info) { + if (status === 400) { + sync.log.trace("Entering kony.sync.konyUploadChanges->uploadNetworkCallbackStatus"); + if (kony.sync.eligibleForRetry(result.opstatus, retries)) { + retries--; + kony.sync.retryServiceCall(kony.sync.getUploadURL(), result, info, retries, retryCallback, params); + } else { + kony.sync.setSessionID(result); + uploadNetworkcallback(result, json); + results1 = null; + jsonLua = null; + } + } else if (status === 300) { + uploadNetworkcallback(kony.sync.getNetworkCancelError(), json); + } + } + + function retryCallback(result, info, retry) { + sync.log.trace("Entering kony.sync.konyUploadChanges->retryCallback"); + retries = retry; + uploadNetworkCallbackStatus(400, result); + } + + if (lastjson === null) { + if (!kony.sync.isNullOrUndefined(changes.tables)) { + for (var i = 0; i < changes.tables.length; i++) { + var tableChange = changes.tables[i]; + var tableName = tableChange.tableName; + if (!kony.sync.isNullOrUndefined(tableChange.changes)) { + for (var j = 0; j < tableChange.changes.length; j++) { + var rowChange = tableChange.changes[j]; + if (kony.sync.isNullOrUndefined(rowChange.syncConflict)) { + rowChange.syncConflict = ""; + } + var result = { + metadata: { + type: tableName, + uri: changes.uri, + changetype: rowChange.changeType, + syncConflict: rowChange.syncConflict + } + }; + if (!kony.sync.isNullOrUndefined(rowChange.fields)) { + var fcount = kony.sync.getArrayCount(rowChange.fields); + for (var k = 0; k < fcount; k++) { + if (rowChange.fields[k] !== "ServerId" && rowChange.fields[k] !== "UpdateId") { + result[rowChange.fields[k]] = rowChange.values[k]; + } + } + } + results1.push(result); + } + } + } + } + var moreChangesAvailable = null; + if (lastBatch === true) { + moreChangesAvailable = false; + } else { + moreChangesAvailable = true; + } + jsonLua = { + d: { + results: results1, + sync: "not implemented", + scopeName: changes.scopeName, + serverBlob: changes.serverblob, + clientid: changes.clientid, + SequenceNumber: changes.SequenceNumber, + moreChangesAvailable: moreChangesAvailable + } + }; + json = JSON.stringify(jsonLua); + } else { + json = lastjson; + } + + var params = {}; + kony.sync.commonServiceParams(params); + params.UploadRequest = json; + params.scopename = kony.sync.currentScope[kony.sync.scopeName]; + params.strategy = kony.sync.currentScope[kony.sync.syncStrategy]; + params.instanceid = kony.sync.getInstanceID(); + params.clientid = kony.sync.getDeviceID(); + params.appVersion = kony.sync.currentSyncConfigParams.appVersion; + if (kony.sync.forceUpload || kony.sync.forceUploadUpgrade) { + params.usehistoryconfig = "true"; + } + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks]) && + !kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][kony.sync.currentScope[kony.sync.scopeName]])) { + params[kony.sync.sessionTaskUploadErrorPolicy] = kony.sync.currentSyncConfigParams[kony.sync.sessionTasks][kony.sync.currentScope[kony.sync.scopeName]][kony.sync.sessionTaskUploadErrorPolicy]; + } + + if (!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey])) { + params.httpconfig = { + timeout: kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey] + }; + } + + params.clientcontext = kony.sync.uploadClientContext; + var paramsToSend = null; + var currentSyncReturnParamsTemp = kony.sync.currentSyncReturnParams; + currentSyncReturnParamsTemp.uploadRequest = params; + kony.sync.deleteMapKey(currentSyncReturnParamsTemp, kony.sync.serverDetails); + if (kony.sync.isUploadStarted) { + paramsToSend = kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onUploadStart], currentSyncReturnParamsTemp); + if (paramsToSend != null) { + params = paramsToSend; + kony.sync.uploadClientContext = params.clientcontext; + } + kony.sync.isUploadStarted = false; + } + + currentSyncReturnParamsTemp.uploadRequest = params; + paramsToSend = kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onUploadBatchStart], currentSyncReturnParamsTemp); + if (!kony.sync.isNullOrUndefined(paramsToSend)) { + params = paramsToSend; + kony.sync.uploadClientContext = params.clientcontext; + } + params.clientcontext = JSON.stringify(kony.sync.uploadClientContext); + currentSyncReturnParamsTemp = null; + paramsToSend = null; + + sync.log.info("Hitting the service with URL : " + kony.sync.getUploadURL(), params); + kony.sync.invokeServiceAsync(kony.sync.getUploadURL(), params, uploadNetworkCallbackStatus, null); +}; + +kony.sync.konyRegisterDevice = function(registerDeviceCallback) { + sync.log.trace("Entering kony.sync.konyRegisterDevice"); + if (kony.sync.isSyncStopped) { + kony.sync.stopSyncSession(); + return; + } + var retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + + function registerDeviceCallbackStatus(status, result) { + if (status === 400) { + sync.log.trace("Entering kony.sync.konyRegisterDevice->registerDeviceCallbackStatus"); + if (kony.sync.eligibleForRetry(result.opstatus, retries)) { + retries--; + kony.sync.retryServiceCall(kony.sync.getRegisterDeviceURL(), result, null, retries, retryCallback, params); + } else { + kony.sync.setSessionID(result); + registerDeviceCallback(result); + } + } else if (status === 300) { + registerDeviceCallback(kony.sync.getNetworkCancelError()); + } + } + + function retryCallback(result, info, retry) { + sync.log.trace("Entering kony.sync.konyRegisterDevice->retryCallback"); + retries = retry; + registerDeviceCallbackStatus(400, result, info); + } + var params = {}; + kony.sync.commonServiceParams(params); + params.os = kony.os.deviceInfo().name; + params.model = kony.os.deviceInfo().model; + params.version = kony.os.deviceInfo().version + ""; + params.deviceID = kony.sync.getDeviceID(); + params.userAgent = kony.os.userAgent(); + params.channel = kony.sync.getChannelName(); + params.platform = kony.sync.getPlatformName(); + if (!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey])) { + params.httpconfig = { + timeout: kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey] + }; + } + + sync.log.info("Hitting the service with URL :" + kony.sync.getRegisterDeviceURL(), params); + + kony.sync.invokeServiceAsync(kony.sync.getRegisterDeviceURL(), params, registerDeviceCallbackStatus, null); +}; + +kony.sync.callSchemaUpgradeService = function(schemaUpgradeCallback, scriptsRequired) { + sync.log.trace("Entering kony.sync.callSchemaUpgradeService"); + if (kony.sync.isSyncStopped) { + kony.sync.stopSyncSession(); + return; + } + var retries = kony.sync.currentSyncConfigParams[kony.sync.numberOfRetriesKey]; + + function schemaUpgradeServiceStatus(status, result) { + if (status === 400) { + sync.log.trace("Entering kony.sync.callSchemaUpgradeService->schemaUpgradeServiceStatus"); + if (kony.sync.eligibleForRetry(result.opstatus, retries)) { + retries--; + kony.sync.retryServiceCall(kony.sync.getSchemaUpgradeURL(), result, null, retries, retryCallback, params); + } else { + kony.sync.setSessionID(result); + schemaUpgradeCallback(result); + } + } + } + + function retryCallback(result, info, retry) { + sync.log.trace("Entering kony.sync.callSchemaUpgradeService->retryCallback"); + retries = retry; + schemaUpgradeServiceStatus(400, result, info); + } + var params = {}; + kony.sync.commonServiceParams(params); + params.clientid = kony.sync.getDeviceID(); + params.appversion = konysyncClientSyncConfig.Version; + params.dbversion = kony.sync.configVersion; + params.scriptsrequired = (scriptsRequired === false) ? "false" : "true"; + var paramsToSend = null; + paramsToSend = kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onUpgradeQueriesDownloadStartKey], params); + if (!kony.sync.isNullOrUndefined(paramsToSend)) { + params = paramsToSend; + } + + if (!kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey])) { + params.httpconfig = { + timeout: kony.sync.currentSyncConfigParams[kony.sync.networkTimeOutKey] + }; + } + + sync.log.info("Hitting the service with URL :" + kony.sync.getSchemaUpgradeURL(), params); + + kony.sync.invokeServiceAsync(kony.sync.getSchemaUpgradeURL(), params, schemaUpgradeServiceStatus, null); +}; + +kony.sync.getServerURL = function() { + sync.log.trace("Entering kony.sync.getServerURL "); + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams.serverurl)) { + return kony.sync.currentSyncConfigParams.serverurl; + } + var server = ""; + if (kony.sync.currentSyncConfigParams.issecure === true) { + server = "https://" + kony.sync.currentSyncConfigParams.serverhost; + } else { + server = "http://" + kony.sync.currentSyncConfigParams.serverhost; + } + if (kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams.serverport)) { + server = server + ":80"; + } else if (kony.sync.currentSyncConfigParams.serverport !== "") { + server = server + ":" + kony.sync.currentSyncConfigParams.serverport; + } + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.authTokenKey])) { + return server + "/syncservice/api/v1/" + kony.sync.getAppId() + "/"; + } else { + return server + "/syncservice/resources/"; + } +}; + +kony.sync.getUploadURL = function() { + sync.log.trace("Entering kony.sync.getUploadURL "); + var server = kony.sync.getServerURL(); + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams.uploadwebcontext)) { + return server + kony.sync.currentSyncConfigParams.uploadwebcontext; + } + return server + "upload"; +}; + +kony.sync.getDownloadURL = function() { + sync.log.trace("Entering kony.sync.getDownloadURL "); + var server = kony.sync.getServerURL(); + if (!kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams.downloadwebcontext)) { + return server + kony.sync.currentSyncConfigParams.downloadwebcontext; + } + return server + "download"; +}; + +kony.sync.getRegisterDeviceURL = function() { + sync.log.trace("Entering kony.sync.getRegisterDeviceURL "); + var server = kony.sync.getServerURL(); + return server + "registerdevice"; +}; + +kony.sync.getSchemaUpgradeURL = function() { + sync.log.trace("Entering kony.sync.getSchemaUpgradeURL "); + var server = kony.sync.getServerURL(); + return server + "upgrade"; +}; + + +kony.sync.httprequest = null; +kony.sync.httprequestsinglesession = false; +//IF user passes his own function instead of using kony.net.invokeServiceAsync +//this is how it would be called. +kony.sync.invokeServiceAsync = function(url, params, callback, context) { + if (kony.sync.isMbaasEnabled) { + kony.sdk.claimsRefresh(claimsRefreshSuccessCallBack, claimsRefreshFailureCallBack); + + function claimsRefreshSuccessCallBack() { + if (params && params.httpheaders) { + var currentClaimToken = kony.sdk.getCurrentInstance().currentClaimToken; + if (kony.sync.currentSyncConfigParams[kony.sync.authTokenKey] != currentClaimToken) { + kony.sync.currentSyncConfigParams[kony.sync.authTokenKey] = currentClaimToken; + } + params.httpheaders["X-Kony-Authorization"] = currentClaimToken; + invokeServiceAsyncHelper(url, params, callback, context); + } + } + + function claimsRefreshFailureCallBack(res) { + callback(400, res, context); + } + } else { + invokeServiceAsyncHelper(url, params, callback, context); + } + + function invokeServiceAsyncHelper(url, params, callback, context) { + if (kony.sync.isNull(kony.sync.currentSyncConfigParams[kony.sync.invokeServiceFunctionKey])) { + //#ifdef KONYSYNC_IOS + var deviceInfo = kony.os.deviceInfo(); + var timeoutValue = 0; + var paramsHttpheaders = null; + if (kony.sync.isPhonegap || deviceInfo.osversion < 7) { + kony.net.invokeServiceAsync(url, params, callback, context); + } else { + var paramsTable = new kony.net.FormData(); + for (var key in params) { + if (!kony.sync.isNull(params[key])) { + if (key === "httpheaders") { + paramsHttpheaders = params[key]; + continue; + } + if (key === "httpconfig") { + timeoutValue = kony.sync.tonumber(params[key]["timeout"]); + continue; + } + paramsTable.append((key), (params[key])); + } + } + + function createNewHttpRequest(sessionid, paramsHttpheaders, localRequestCallback, url, timeoutValue) { + var httprequest = null; + httprequest = (sessionid === null) ? new kony.net.HttpRequest() : new kony.net.HttpRequest(sessionid); + httprequest.backgroundTransfer = true; + httprequest.onReadyStateChange = localRequestCallback; + httprequest.open(constants.HTTP_METHOD_POST, url); + // + if (timeoutValue !== 0) { + httprequest.timeout = timeoutValue * 1000; + } + // + if (paramsHttpheaders !== null) { + for (var key in paramsHttpheaders) { + httprequest.setRequestHeader(key, paramsHttpheaders[key]); + } + } + if (paramsHttpheaders === null || typeof(paramsHttpheaders["Content-Type"]) === 'undefined') { + httprequest.setRequestHeader("Content-Type", "application/json"); + } + return httprequest; + }; + var httprequest = kony.sync.httprequest; + if (null === httprequest) { + httprequest = createNewHttpRequest(null, paramsHttpheaders, localRequestCallback, url, timeoutValue); + kony.sync.httprequest = httprequest; + kony.sync.httprequestsession = httprequest.getSession(); + } else if (false === kony.sync.httprequestsinglesession) { + if (kony.sync.httprequestsession) { + httprequest = createNewHttpRequest(kony.sync.httprequestsession, paramsHttpheaders, localRequestCallback, url, timeoutValue); + kony.sync.httprequest = httprequest; + kony.sync.httprequestsinglesession = true; + } + } else { + httprequest.abort(); + httprequest.onReadyStateChange = localRequestCallback; + httprequest.open(constants.HTTP_METHOD_POST, url); + } + httprequest.send(paramsTable); + } + //#else + kony.net.invokeServiceAsync(url, params, callback, context); + //#endif + } else { + kony.sync.currentSyncConfigParams[kony.sync.invokeServiceFunctionKey](url, params, callback, context); + } + + function localRequestCallback(httprequest) { + if (httprequest.readyState === 4 && httprequest.status === 200) { + callback(400, httprequest.response, context); + } else if (httprequest.readyState === 4) { + httprequest.response = { + 'opstatus': 1012 + }; + callback(400, httprequest.response, context); + } + } + } //end of invokeServiceAsyncHelper +}; + +kony.sync.commonServiceParams = function(params) { + sync.log.trace("Entering kony.sync.commonServiceParams "); + var httpheaders = {}; + if (kony.sync.isNullOrUndefined(kony.sync.currentSyncConfigParams[kony.sync.authTokenKey])) { + params.userid = kony.sync.currentSyncConfigParams.userid; + params.password = kony.sync.genHash(kony.sync.currentSyncConfigParams[kony.sync.passwordHashingAlgo], kony.sync.currentSyncConfigParams.password); + params.AppID = kony.sync.getAppId(); + } else { + if (!kony.sync.isMbaasEnabled) { + kony.sync.isMbaasEnabled = true; + } + httpheaders["X-Kony-Authorization"] = kony.sync.currentSyncConfigParams[kony.sync.authTokenKey]; + } + if (!kony.sync.isNullOrUndefined(kony.sync.sessionMap[kony.sync.konySyncSessionID]) && + !kony.sync.isNullOrUndefined(kony.sync.sessionMap[kony.sync.konySyncRequestNumber])) { + params.konysyncsessionid = kony.sync.sessionMap[kony.sync.konySyncSessionID]; + params.konysyncrequestnumber = kony.sync.sessionMap[kony.sync.konySyncRequestNumber]; + } + httpheaders["Content-Type"] = "application/json"; + params.httpheaders = httpheaders; +}; + +kony.sync.setSessionID = function(response) { + if (!kony.sync.isNullOrUndefined(response.d) && !kony.sync.isNullOrUndefined(response.d.__session)) { + kony.sync.sessionMap[kony.sync.konySyncSessionID] = response.d.__session.id; + kony.sync.sessionMap[kony.sync.konySyncRequestNumber] = response.d.__session.requestnumber; + } +}; + +kony.sync.resetSessionVars = function() { + kony.sync.sessionMap = {}; +}; + +kony.sync.getDownloadBinaryURL = function() { + sync.log.trace("Entering kony.sync.getDownloadURL "); + var server = kony.sync.getServerURL(); + return server + "downloadBinary"; +}; +// **************** End konySyncServiceProvider.js******************* + + +// **************** Start KonySyncSkyLib.js******************* +//#ifdef bb10 +sky = null; +//#endif +kony.sky = {}; +//Sky Constants +kony.sky.EventStart = "START"; +kony.sky.EventFinish = "FINISH"; +kony.sky.EventError = "ERROR"; + +kony.sky.ConfigParamServer = "SERVER"; +kony.sky.ConfigParamPort = "PORT"; +kony.sky.ConfigParamProfile = "PROFILE"; +kony.sky.ConfigParamUsewifi = "USEWIFI"; +kony.sky.ConfigParamUser = "USER"; +kony.sky.ConfigParamPasswd = "PASSWORD"; +kony.sky.BBPlatform = "blackberry"; +kony.sky.TrueStr = "TRUE"; +kony.sky.BBPlatformName = "blackberry"; +kony.sky.ConfigParamConnMode = "CONNECTIONMODE"; + +kony.sky.startSkyCallback = "onSkyStart"; +kony.sky.startIdentifyCallback = "onIndentifyStart"; +kony.sky.successIdentifyCallback = "onIndentifySuccess"; +kony.sky.errorIdentifyCallback = "onIndentifyError"; +kony.sky.errorSkyCallback = "onSkyError"; +kony.sky.startSessionCallback = "onSessionStart"; +kony.sky.successSessionCallback = "onSessionSuccess"; +kony.sky.errorSessionCallback = "onSessionError"; +kony.sky.successSkyCallback = "onSkySuccess"; + +kony.sky.errorCode = "errorCode"; +kony.sky.errorMessage = "errorMessage"; +//provision callback methods +kony.sky.startProvisionCallback = "onProvisionStart"; +kony.sky.successProvisionCallback = "onProvisionSuccess"; +kony.sky.errorProvisionCallback = "onProvisionError"; +//reset callback methods +kony.sky.startResetCallback = "onResetStart"; +kony.sky.successResetCallback = "onResetSuccess"; +kony.sky.errorResetCallback = "onResetError"; +//stop callback methods +kony.sky.startStopCallback = "onStopStart"; +kony.sky.successStopCallback = "onStopSuccess"; +kony.sky.errorStopCallback = "onStopError"; + +//dataobject upload callback methods +kony.sky.startUploadCallback = "onUploadStart"; +kony.sky.successUploadCallback = "onUploadSuccess"; +kony.sky.errorUploadCallback = "onUploadError"; +//transaction +kony.sky.startTransactionCallback = "onStartTransaction"; +kony.sky.successTransactionCallback = "onSuccessTransaction"; + +kony.sky.parentTableInfo = "parentTable"; + +kony.sky.provisionSkySync = function(config){ + sync.log.trace("Entering kony.sky.provisionSkySync "); + //#ifdef bb10 + kony.sky.initializeSkyNamespace(); + //#endif + var isProvisioned = sky.isProvisioned(); + sync.log.info("SkySync engine provisioned status : ", isProvisioned); + if(config[kony.sky.ConfigParamServer] === null || config[kony.sky.ConfigParamServer] === "" || config[kony.sky.ConfigParamPort] === null || config[kony.sky.ConfigParamPort] === "" || config[kony.sky.ConfigParamProfile] === null || config[kony.sky.ConfigParamProfile] === "") { + var params = {}; + params[kony.sky.errorCode] = "7101"; + params[kony.sky.errorMessage] = kony.sky.errorMessageForCode(params[kony.sky.errorCode]); + kony.sync.verifyAndCallClosure(config[kony.sky.errorProvisionCallback],params); + return; + } + if(!isProvisioned){ + var inputParam = {}; + inputParam[kony.sky.ConfigParamServer] =config[kony.sky.ConfigParamServer]; + inputParam[kony.sky.ConfigParamPort] = config[kony.sky.ConfigParamPort]; + inputParam[kony.sky.ConfigParamProfile] = config[kony.sky.ConfigParamProfile]; + if(!kony.sync.isNull(config[kony.sky.ConfigParamPasswd])){ + inputParam[kony.sky.ConfigParamPasswd] = config[kony.sky.ConfigParamPasswd]; + } + if(!kony.sync.isNull(config[kony.sky.ConfigParamUser])){ + inputParam[kony.sky.ConfigParamUser] = config[kony.sky.ConfigParamUser]; + } + if(!kony.sync.isNull(config[kony.sky.ConfigParamUsewifi])){ + inputParam[kony.sky.ConfigParamUsewifi] = config[kony.sky.ConfigParamUsewifi]; + } + if(!kony.sync.isNull(config[kony.sky.ConfigParamConnMode])){ + inputParam[kony.sky.ConfigParamConnMode] = config[kony.sky.ConfigParamConnMode]; + } + sky.provision(inputParam, provisionSkySyncCallback); + }else{ + kony.sync.verifyAndCallClosure(config[kony.sky.successProvisionCallback],null); + } + function provisionSkySyncCallback( event, args ){ + if((event !== kony.sky.EventStart)){ + if((event === kony.sky.EventError)){ + if((args !== null)){ + var params = {}; + params[kony.sky.errorCode] = args.ERRORCODE; + params[kony.sky.errorMessage] = args.ERRORDESC; + kony.sync.verifyAndCallClosure(config[kony.sky.errorProvisionCallback],params); + } + } + if((event === kony.sky.EventFinish)){ + kony.sync.verifyAndCallClosure(config[kony.sky.successProvisionCallback],null); + } + }else{ + kony.sync.verifyAndCallClosure(config[kony.sky.startProvisionCallback],null); + } + } +}; + +kony.sky.startSkySyncSession = function(config){ + sync.log.trace("Entering kony.sky.startSkySyncSession "); + var isIdentified = sky.isIdentified(); + if(config[kony.sky.ConfigParamUser] === null || config[kony.sky.ConfigParamPasswd] === null) { + var params = {}; + params[kony.sky.errorCode] = "7101"; + params[kony.sky.errorMessage] = kony.sky.errorMessageForCode(params[kony.sky.errorCode]); + kony.sync.verifyAndCallClosure(config[kony.sky.errorSkyCallback],params); + return; + } + kony.sync.verifyAndCallClosure(config[kony.sky.startSkyCallback ],null); + if(!isIdentified){ + var identifyParams = {}; + identifyParams[kony.sky.ConfigParamUser] = config[kony.sky.ConfigParamUser]; + identifyParams[kony.sky.ConfigParamPasswd] = config[kony.sky.ConfigParamPasswd]; + if(!kony.sync.isNull(config[kony.sky.ConfigParamUsewifi])){ + identifyParams[kony.sky.ConfigParamUsewifi] = config[kony.sky.ConfigParamUsewifi]; + } + if(!kony.sync.isNull(config[kony.sky.ConfigParamConnMode])){ + identifyParams[kony.sky.ConfigParamConnMode] = config[kony.sky.ConfigParamConnMode]; + } + sky.identify(identifyParams,false,identifySkySyncCallback); + }else{ + identifySkySyncCallback(kony.sky.EventFinish, [ ]); + } + function identifySkySyncCallback( event, args ){ + if(event !== kony.sky.EventStart){ + if(event === kony.sky.EventError){ + if((args !== null)){ + var params = {}; + params[kony.sky.errorCode] = args.ERRORCODE; + params[kony.sky.errorMessage] = args.ERRORDESC; + kony.sync.verifyAndCallClosure(config[kony.sky.errorIdentifyCallback],params); + } + } + if(event === kony.sky.EventFinish){ + kony.sync.verifyAndCallClosure(config[kony.sky.successIdentifyCallback],null); + startSkySync(); + } + } + else{ + kony.sync.verifyAndCallClosure(config[kony.sky.startIdentifyCallback],null); + } + } + function startSkySync( ){ + sync.log.trace("Entering startSkySync "); + var isStarted = sky.isStarted(); + sync.log.info("SkySync server status : ", isStarted); + kony.sync.verifyAndCallClosure(config[kony.sky.startSessionCallback],null); + if((!isStarted)){ + sky.start(startSkySyncCallback); + }else{ + startSkySyncCallback(kony.sky.EventFinish, [ ]); + } + } + + function startSkySyncCallback( event, args ){ + if(event !== kony.sky.EventStart){ + if(event === kony.sky.EventError){ + if((args !== null)){ + var params = {}; + params[kony.sky.errorCode] = args.ERRORCODE; + params[kony.sky.errorMessage] = args.ERRORDESC; + kony.sync.verifyAndCallClosure(config[kony.sky.errorSessionCallback],params); + } + } + if(event === kony.sky.EventFinish){ + sync.log.info("SkySync server started Successful"); + kony.sync.verifyAndCallClosure(config[kony.sky.successSessionCallback],null); + kony.sync.verifyAndCallClosure(config[kony.sky.successSkyCallback],null); + } + } + } +}; + +kony.sky.skyEmptyFunction = function(){ + sync.log.trace("Entering kony.sky.skyEmptyFunction "); +}; + +kony.sky.getSkyGuiID = function(){ + sync.log.trace("Entering kony.sky.getSkyGuiID "); + var serviceId = sky.getParameter("SERVERID"); + var currendate = kony.os.date("mm/dd/yyyy"); + var currtime = kony.sky.replaceColon(kony.os.time()); + var datevalue = currendate.split ("/"); + var resultDate = datevalue[2] + datevalue[0] + datevalue[1] + currtime; + var GUID = serviceId + "-" + resultDate; + return GUID; +}; + + kony.sky.replaceColon = function(currtime){ + sync.log.trace("Entering kony.sky.replaceColon "); + if(kony.string.containsChars(currtime,[":"])){ + currtime = currtime.replace (":", ""); + currtime = kony.sky.replaceColon(currtime); + } + return currtime; +}; + + +kony.sky.generatePKTable = function(pk){ + sync.log.trace("Entering kony.sky.generatePKTable "); + var i = 0; + var pks = []; + for (var j in pk){ + var v = pk[j]; + if(!kony.sync.isNull(v.key)){ + pks[i] = v.key + " = " + v.value; + } + else{ + pks[i] = j + " = " + v; + } + i = i + 1; + } + return pks; +}; + +kony.sky.buildConditionSet = function(srchByTargetAttribute, targetKey){ + sync.log.trace("Entering kony.sky.buildConditionSet "); + var conditionSet = []; + conditionSet[ 0 ] = srchByTargetAttribute + " = " + targetKey; + return conditionSet; +}; + +kony.sky.beginTransaction = function(config){ + sync.log.trace("Entering kony.sky.beginTransaction "); + sky.beginTransaction(config[kony.sky.successTransactionCallback]); +}; + +kony.sky.commitTransaction = function(config){ + sync.log.trace("Entering kony.sky.commitTransaction "); + sky.commitTransaction(config[kony.sky.successTransactionCallback]); +}; + +kony.sky.rollbackTransaction = function(config){ + sync.log.trace("Entering kony.sky.rollbackTransaction "); + sky.rollbackTransaction(config[kony.sky.successTransactionCallback]); +}; + +kony.sky.resetSkyEngine = function(config){ + sync.log.trace("Entering kony.sky.resetSkyEngine "); + function resetCallback( event, args ){ + if((event !== kony.sky.EventStart)){ + if((event === kony.sky.EventError)){ + if((args !== null)){ + var params = {}; + params[kony.sky.errorCode] = args.ERRORCODE; + params[kony.sky.errorMessage] = args.ERRORDESC; + kony.sync.verifyAndCallClosure(config[kony.sky.errorResetCallback],params); + } + } + if((event === kony.sky.EventFinish)){ + kony.sync.verifyAndCallClosure(config[kony.sky.successResetCallback],null); + } + }else{ + kony.sync.verifyAndCallClosure(config[kony.sky.startResetCallback],null); + } + } + sky.reset(resetCallback); +}; + +kony.sky.stopSkyEngine = function(config){ + sync.log.trace("Entering kony.sky.stopSkyEngine "); + function stopCallback( event, args ){ + if((event !== kony.sky.EventStart)){ + if((event === kony.sky.EventError)){ + if((args !== null)){ + var params = {}; + params[kony.sky.errorCode] = args.ERRORCODE; + params[kony.sky.errorMessage] = args.ERRORDESC; + kony.sync.verifyAndCallClosure(config[kony.sky.errorStopCallback],params); + } + } + if((event === kony.sky.EventFinish)){ + if(sky.isStarted()){ + sky.stop(stopCallback); + }else{ + kony.sync.verifyAndCallClosure(config[kony.sky.successStopCallback],null); + } + } + }else{ + kony.sync.verifyAndCallClosure(config[kony.sky.startStopCallback],null); + } + } + if(sky.isStarted()){ + sky.stop(stopCallback); + }else{ + kony.sync.verifyAndCallClosure(config[kony.sky.successStopCallback],null); + } + +}; + +kony.sky.errorMessageForCode = function( errorCode ){ + sync.log.trace("Entering kony.sky.errorMessageForCode "); + var statusMsgTable = {}; + statusMsgTable["-1002"] = "ERROR_ALREADY_IDENTIFIED"; + statusMsgTable["-1003"] = "ERROR_ALREADY_PROVISIONED"; + statusMsgTable["-1004"] = "ERROR_BAD_CONDITION_SET"; + statusMsgTable["-1005"] = "ERROR_BLACKLISTED"; + statusMsgTable["-1006"] = "ERROR_CONFIGURATION"; + statusMsgTable["-1007"] = "ERROR_DATA_OBJECT_NOT_FOUND"; + statusMsgTable["-1008"] = "ERROR_DUPLICATE_ITEM"; + statusMsgTable["-1009"] = "ERROR_ENCRYPTION_HANDSHAKE"; + statusMsgTable["-1010"] = "ERROR_ENCRYPTION_MISMATCH"; + statusMsgTable["-1001"] = "ERROR_GENERAL_FAILURE"; + statusMsgTable["-1011"] = "ERROR_HOST_IF_SETUP_ERROR"; + statusMsgTable["-1012"] = "ERROR_HOST_NOT_AVAILABLE"; + statusMsgTable["-1013"] = "ERROR_IDENTITY_FAILURE"; + statusMsgTable["-1014"] = "ERROR_INVALID_PARAMETER"; + statusMsgTable["-1015"] = "ERROR_IS_STARTED"; + statusMsgTable["-1016"] = "ERROR_MEAP_IS_DISABLED"; + statusMsgTable["-1017"] = "ERROR_NO_CONFIGURATION"; + statusMsgTable["-1018"] = "ERROR_NO_INSTANCES_SELECTED"; + statusMsgTable["-1019"] = "ERROR_NOT_IDENTIFIED"; + statusMsgTable["-1020"] = "ERROR_NOT_PROVISIONED"; + statusMsgTable["-1021"] = "ERROR_NOT_RUNNING"; + statusMsgTable["-1022"] = "ERROR_PROFILE_DEACTIVATED"; + statusMsgTable["-1023"] = "ERROR_PROFILE_NOT_FOUND"; + statusMsgTable["-1024"] = "ERROR_RETRY"; + statusMsgTable["-1025"] = "ERROR_TABLE_NOT_FOUND"; + statusMsgTable["-1026"] = "ERROR_UNCAUGHT_EXCEPTION"; + statusMsgTable["-1027"] = "ERROR_USER_NOT_FOUND"; + statusMsgTable["7101"] = "MISSING ATTRIBUTES FOR SKY"; + var errMsg = ""; + if(statusMsgTable[errorCode] === null) { + errMsg = "Some unknown error"; + }else{ + errMsg = statusMsgTable[errorCode]; + } + return errMsg; +}; + + +kony.sky.buildSkyOrderByMap = function(orderByMap){ + sync.log.trace("Entering kony.sky.buildSkyOrderByMap "); + var i = 0; + var ordering = []; + for ( var j in orderByMap ){ + var v = orderByMap[j]; + var sortType = v.sortType; + var orderBy = (v.key).toString() ; + if(sortType === "desc"){ + orderBy = orderBy +" D*"; + }else{ + orderBy = orderBy + " *"; + } + ordering[ i ] = orderBy ; + i = i + 1; + } + return ordering; +}; +//#ifdef bb10 +kony.sky.initializeSkyNamespace = function(){ + if (sky === null) { + sky = new SkySync.ffi(); + } +}; +//#endif +//#ifdef android +kony.sky.initializeSkySync = function(){ + sky.initializeSkySync(); +}; +//#endif +//#ifdef tabrcandroid +kony.sky.initializeSkySync = function(){ + sky.initializeSkySync(); +}; +//#endif +skySync = { + init : kony.sky.provisionSkySync, + startSession : kony.sky.startSkySyncSession, + reset : kony.sky.resetSkyEngine, + stop : kony.sky.stopSkyEngine, + beginTransaction : kony.sky.beginTransaction, + rollbackTransaction :kony.sky.rollbackTransaction, + commitTransaction : kony.sky.commitTransaction, + //#ifdef KONYSYNC_BB10 + initializeSkyNamespace : kony.sky.initializeSkyNamespace + //#endif + //#ifdef KONYSYNC_ANDROID + initializeSkySync : kony.sky.initializeSkySync + //#endif +// quiesce : kony.sky.quiesce, + //unquiesce : kony.sky.unquiesce +}; +// **************** End KonySyncSkyLib.js******************* + + +// **************** Start KonySyncUpload.js******************* +if(typeof(kony.sync)=== "undefined"){ + kony.sync = {}; +} +if(typeof(sync) === "undefined") { + sync = {}; +} + +kony.sync.syncUploadChanges = function(sname, dsname, onCompletion) { + sync.log.trace("Entering kony.sync.syncUploadChanges "); + kony.sync.onUploadCompletion = onCompletion; + kony.sync.resetuploadsessioglobals(); + kony.sync.objectLevelInfoMap = {}; + kony.sync.OTAChangestobeDeleted = []; + kony.sync.uploadcontextMap = {}; + kony.sync.getLastSyncUploadContext(sname, dsname, kony.sync.syncUploadChangesForBatch); +}; + +kony.sync.createClone = function(obj) { + var copy; + if (null == obj || "object" != typeof obj) + return obj; + + if (obj instanceof Array) { + copy = []; + for (var i = 0, len = obj.length; i < len; i++) { + copy[i] = kony.sync.createClone(obj[i]); + } + return copy; + } + + if (obj instanceof Object) { + copy = {}; + for (var attr in obj) { + if (obj.hasOwnProperty(attr)) copy[attr] = kony.sync.createClone(obj[attr]); + } + return copy; + } +} + +kony.sync.syncUploadChangesForBatch = function(rowItem, previousUpload, limit) { + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch"); + var batchSize = kony.sync.getUploadBatchSize(); + var offset = 0; + var serverblob1 = rowItem[kony.sync.metaTableUploadSyncTimeColumn]; + var lastSeqNo = rowItem[kony.sync.metaTableSyncOrderCloumn]; + //previousUpload = "";//temporary -- to be removed while handling duplicate row issue + sync.log.info("Current Scope Server Time Stamp", serverblob1); + kony.sync.currentSyncReturnParams[kony.sync.lastSyncTimestamp] = serverblob1; + kony.sync.currentSyncReturnParams[kony.sync.uploadSequenceNumber] = kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName]; + var firstBatch = false; + var lastBatch = false; + var isError = false; + var changeset = { + clientid: kony.sync.getDeviceID(), + SequenceNumber: kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName], + serverblob: serverblob1, + scopeName: kony.sync.currentScope[kony.sync.scopeName], + uri: kony.sync.currentScope[kony.sync.scopeDataSource], + totalChanges: 0, + tables: [] + }; + + function updateSyncOrderForDeferredRows(tx, limit) { + sync.log.trace("Entering kony.sync.updateSyncOrderForDeferredRows"); + + if(kony.sync.isNullOrUndefined(kony.sync.currentScope.ScopeTables)){ + return true; + } + for (var i = 0; i < kony.sync.currentScope.ScopeTables.length; i++) { + var syncTable = kony.sync.currentScope.ScopeTables[i]; + if(kony.sync.isNullOrUndefined(syncTable)){ + continue; + } + var tablename = syncTable.Name; + var settable = []; + settable[kony.sync.historyTableSyncVersionColumn] = kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName]; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename+kony.sync.historyTableName); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, [{key:kony.sync.historyTableReplaySequenceColumn,value:limit, optype: "LT"}]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + return false; + } + } + return true; + } + + function uploadAllTransaction(tx){ + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch->uploadAllTransaction"); + //get offset for the 1st batch + if(kony.sync.isNull(limit) || previousUpload === "*"){ + if( (previousUpload == "*") && !kony.sync.isNull(limit)) { + if(updateSyncOrderForDeferredRows(tx, limit) === false) { + isError = true; + } + } + offset = kony.sync.getSmallestSequenceNumber(tx); + if(offset===false){ + isError = true; + return; + } + if(previousUpload !== "*"){ + firstBatch = true; //If not resuming after sending duplicate row + }else{ + previousUpload = ""; + } + } + //otherwise increase it by limit + 1 + else{ + offset = limit + 1; + } + + limit = offset + batchSize - 1; + var uploadCache = {}; + if(offset !== -1){ + kony.sync.syncTotalBatchInserts = 0; + kony.sync.syncTotalBatchUpdates = 0; + kony.sync.syncTotalBatchDeletes = 0; + + var scopeName = kony.sync.currentScope[kony.sync.scopeName]; + var changeSetCopy = kony.sync.createClone(changeset); + uploadCache[kony.sync.scope] = scopeName; + uploadCache[kony.sync.offset] = offset; + uploadCache[kony.sync.limit] = limit; + uploadCache[kony.sync.changeSet] = JSON.stringify(changeSetCopy); + uploadCache[kony.sync.lastSequenceNumber] = lastSeqNo; + uploadCache[kony.sync.batchSize] = batchSize; + + //updating the offset in case of kony.sync.getBatchChanges is not able to get records in 1st attempt + limit = kony.sync.getBatchChanges(tx, kony.sync.currentScope, offset, limit, changeset, lastSeqNo, batchSize); + if(limit===false){ + isError = true; + return; + } + kony.sync.syncTotalInserts += kony.sync.syncTotalBatchInserts; + kony.sync.syncTotalUpdates += kony.sync.syncTotalBatchUpdates; + kony.sync.syncTotalDeletes += kony.sync.syncTotalBatchDeletes; + } + + if(limit >= lastSeqNo){ + lastBatch = true; + } + if(offset !== -1){ + uploadCache[kony.sync.lastBatch] = lastBatch; + uploadCache[kony.sync.uploadChangesLimit] = kony.sync.uploadLimit; + cacheLastUploadRequest(tx, uploadCache); + } + + } + + function cacheLastUploadRequest(tx, uploadCache) { + if(changeset.totalChanges > 0) { + var scopeName = kony.sync.currentScope[kony.sync.scopeName] + var lastRequest = kony.sync.checkForPendingUpload(tx, scopeName); + if(lastRequest != "") { + return; + } + var contextInfo = {}; + contextInfo[kony.sync.metaTableScopeColumn] = scopeName; + contextInfo[kony.sync.pendingUploadTableInsertCount] = kony.sync.syncTotalInserts; + contextInfo[kony.sync.pendingUploadTableUpdateCount] = kony.sync.syncTotalUpdates; + contextInfo[kony.sync.pendingUploadTableDeleteCount] = kony.sync.syncTotalDeletes; + contextInfo[kony.sync.pendingUploadTableBatchInsertCount] = kony.sync.syncTotalBatchInserts; + contextInfo[kony.sync.pendingUploadTableBatchUpdateCount] = kony.sync.syncTotalBatchUpdates; + contextInfo[kony.sync.pendingUploadTableBatchDeleteCount] = kony.sync.syncTotalBatchDeletes; + contextInfo[kony.sync.pendingUploadTableObjectLevelInfo] = JSON.stringify(kony.sync.objectLevelInfoMap); + contextInfo[kony.sync.pendingUploadTableUploadRequest] = JSON.stringify(uploadCache); + contextInfo[kony.sync.pendingUploadTableUploadLimit] = kony.sync.uploadLimit; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_insert(query, kony.sync.pendingUploadTableName); + kony.sync.qb_set(query, contextInfo); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + if (resultSet === false) { + isError = true; + } + } + } + + function uploadTransactionSuccess(){ + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch->uploadTransactionSuccess"); + if(changeset.totalChanges > 0 || previousUpload !== ""){ + if(firstBatch){ + //kony.sync.deleteMapKey(kony.sync.currentSyncReturnParams, kony.sync.serverDetails); + //kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onUploadStart], kony.sync.currentSyncReturnParams); + kony.sync.isUploadStarted = true; + } + //kony.sync.konyUploadChanges(changeset, uploadAllTransactionSuccess, lastBatch); + if(previousUpload===""){ + kony.sync.konyUploadChanges(changeset, uploadAllTransactionSuccess, lastBatch, null); + } + else{ + kony.sync.konyUploadChanges(null, uploadAllTransactionSuccess, null, changeset); + } + } + else{ + if(firstBatch){ //nothing to upload, hence skip it + kony.sync.uploadCompleted(); + } + else{ //upload batch processing finished + kony.sync.currentSyncReturnParams[kony.sync.uploadContext] = kony.sync.uploadcontextMap; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onUploadSuccess], kony.sync.currentSyncReturnParams); + kony.sync.currentSyncReturnParams[kony.sync.uploadContext] = {}; + kony.sync.uploadcontextMap = {}; + kony.sync.onUploadCompletion(false, null); + } + } + } + function transactionErrorCallback(){ + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch->transactionErrorCallback"); + if (!isError){ + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } + else{ + kony.sync.syncUploadFailed(kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + function uploadAllTransactionSuccess(otaServerChanges, oldJson) { + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch->uploadAllTransactionSuccess"); + sync.log.info("Upload response:", otaServerChanges); + if (!kony.sync.isNullOrUndefined(otaServerChanges.opstatus) && otaServerChanges.opstatus !== 0){ + if (!kony.sync.isNullOrUndefined(otaServerChanges.d)) { + kony.sync.deleteLastUploadRequestWithNewTransaction(deleteLastUploadRequestCallback); + } else { + addLastUploadRequestCallback(); + } + return; + } + else if(kony.sync.isNullOrUndefined(otaServerChanges.d)){ + kony.sync.onUploadCompletion(true, kony.sync.getServerError(otaServerChanges)); + return; + } + function addLastUploadRequestCallback(){ + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch->addLastUploadRequestCallback"); + kony.sync.onUploadCompletion(true, kony.sync.getServerError(otaServerChanges)); + } + if (otaServerChanges.d.error === "false"){ + if(!kony.sync.isNullOrUndefined(otaServerChanges.d.__sync) && !kony.sync.isNullOrUndefined(otaServerChanges.d.__sync.serverblob)) { + rowItem[kony.sync.metaTableUploadSyncTimeColumn] = otaServerChanges.d.__sync.serverblob; + } + kony.sync.currentSyncReturnParams[kony.sync.serverDetails] = {}; + kony.sync.currentSyncReturnParams[kony.sync.serverDetails][kony.sync.hostName] = kony.sync.getServerDetailsHostName(otaServerChanges); + kony.sync.currentSyncReturnParams[kony.sync.serverDetails][kony.sync.ipAddress] = kony.sync.getServerDetailsIpAddress(otaServerChanges); + kony.sync.clearSyncOrder(kony.sync.currentScope[kony.sync.scopeDataSource], limit, rowItem[kony.sync.metaTableUploadSyncTimeColumn], true, clearSyncOrderCallback); + + } else { + kony.sync.deleteLastUploadRequestWithNewTransaction(deleteLastUploadRequestCallback); + return; + } + + function deleteLastUploadRequestCallback(){ + kony.sync.onUploadCompletion(true,kony.sync.getServerError(otaServerChanges.d)); + } + + function clearSyncOrderCallback(){ + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch->clearSyncOrderCallback"); + if (kony.sync.currentScope[kony.sync.syncStrategy] !== kony.sync.syncStrategy_OTA) { + setSeqNoWrapper(); + } else { + kony.sync.setOTAUploadResponse(otaServerChanges, setSeqNoWrapper); + } + } + + function setSeqNoWrapper(){ + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch->setSeqNoWrapper"); + kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName] = kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName] + 1; + kony.sync.setSeqnumber(kony.sync.currentScope.ScopeName, kony.sync.currentScope[kony.sync.scopeDataSource], kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName], setSeqNoCallback); + } + + function setSeqNoCallback(){ + sync.log.trace("Entering kony.sync.syncUploadChangesForBatch->setSeqNoCallback"); + kony.sync.uploadcontextMap[kony.sync.numberOfRowsUploaded] = kony.sync.syncTotalInserts + kony.sync.syncTotalUpdates + kony.sync.syncTotalDeletes; + kony.sync.uploadcontextMap[kony.sync.numberOfRowsInserted] = kony.sync.syncTotalInserts; + kony.sync.uploadcontextMap[kony.sync.numberOfRowsUpdated] = kony.sync.syncTotalUpdates; + kony.sync.uploadcontextMap[kony.sync.numberOfRowsDeleted] = kony.sync.syncTotalDeletes; + + var uploadBatchContextMap = {}; + uploadBatchContextMap[kony.sync.numberOfRowsUploaded] = kony.sync.syncTotalBatchInserts + kony.sync.syncTotalBatchUpdates + kony.sync.syncTotalBatchDeletes; + uploadBatchContextMap[kony.sync.numberOfRowsInserted] = kony.sync.syncTotalBatchInserts; + uploadBatchContextMap[kony.sync.numberOfRowsUpdated] = kony.sync.syncTotalBatchUpdates; + uploadBatchContextMap[kony.sync.numberOfRowsDeleted] = kony.sync.syncTotalBatchDeletes; + uploadBatchContextMap[kony.sync.serverDetails] = {}; + uploadBatchContextMap[kony.sync.serverDetails][kony.sync.hostName] = kony.sync.getServerDetailsHostName(otaServerChanges); + uploadBatchContextMap[kony.sync.serverDetails][kony.sync.ipAddress] = kony.sync.getServerDetailsIpAddress(otaServerChanges); + + if (kony.sync.currentScope[kony.sync.syncStrategy] === kony.sync.syncStrategy_OTA) { + kony.sync.uploadcontextMap[kony.sync.objectLevelInfo] = kony.sync.objectLevelInfoMap; + kony.sync.uploadcontextMap[kony.sync.numberOfRowsAcknowledged] = kony.sync.serverInsertAckCount + kony.sync.serverUpdateAckCount + kony.sync.serverDeleteAckCount; + kony.sync.uploadcontextMap[kony.sync.numberOfRowsInsertedAck] = kony.sync.serverInsertAckCount; + kony.sync.uploadcontextMap[kony.sync.numberOfRowsUpdatedAck] = kony.sync.serverUpdateAckCount; + kony.sync.uploadcontextMap[kony.sync.numberOfRowsDeletedAck] = kony.sync.serverDeleteAckCount; + kony.sync.uploadcontextMap[kony.sync.failedRowInfo] = kony.sync.uploadSummary; + kony.sync.uploadcontextMap[kony.sync.numberOfRowsFailedtoUpload] = kony.sync.serverFailedCount; + } + var uploadBatchParams = {}; + uploadBatchParams[kony.sync.uploadContext] = kony.sync.uploadcontextMap; + uploadBatchParams[kony.sync.uploadBatchContext] = uploadBatchContextMap; + kony.sync.verifyAndCallClosure(kony.sync.currentSyncConfigParams[kony.sync.onUploadBatchSuccess], uploadBatchParams); + //clearing variables before calling 2nd batch + otaServerChanges = null; + uploadBatchParams = null; + uploadBatchContextMap = null; + changeset = null; + firstBatch = null; + lastBatch = null; + batchSize = null; + offset = null; + serverblob1 = null; + + //call upload batching recursively + kony.sync.syncUploadChangesForBatch(rowItem, previousUpload!==""?"*":"", limit); + } + } + if(previousUpload === "" || previousUpload === "*"){ + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var connection = kony.sync.getConnectionOnly(dbname, dbname, kony.sync.syncUploadFailed); + if(connection!==null){ + kony.db.transaction(connection, uploadAllTransaction, transactionErrorCallback, uploadTransactionSuccess); + } + } + else{ + changeset = previousUpload[kony.sync.pendingUploadTableUploadRequest]; + try{ + kony.sync.objectLevelInfoMap = JSON.parse(previousUpload[kony.sync.pendingUploadTableObjectLevelInfo]); + } + catch(e){ + sync.log.error("Error occurred while re-framing last persisted upload request:" + e); + kony.sync.onUploadCompletion(true, kony.sync.getErrorTable(kony.sync.errorCodeParseError, kony.sync.getErrorMessage(kony.sync.errorCodeParseError,previousUpload[kony.sync.pendingUploadTableObjectLevelInfo], e))); + return; + } + changeset = previousUpload[kony.sync.pendingUploadTableUploadRequest]; + kony.sync.syncTotalInserts = previousUpload[kony.sync.pendingUploadTableInsertCount]; + kony.sync.syncTotalUpdates = previousUpload[kony.sync.pendingUploadTableUpdateCount]; + kony.sync.syncTotalDeletes = previousUpload[kony.sync.pendingUploadTableDeleteCount]; + kony.sync.syncTotalBatchInserts = previousUpload[kony.sync.pendingUploadTableBatchInsertCount]; + kony.sync.syncTotalBatchUpdates = previousUpload[kony.sync.pendingUploadTableBatchUpdateCount]; + kony.sync.syncTotalBatchDeletes = previousUpload[kony.sync.pendingUploadTableBatchDeleteCount]; + limit = previousUpload[kony.sync.pendingUploadTableUploadLimit]; + firstBatch = true; + uploadTransactionSuccess(); + } +}; + +kony.sync.setOTAUploadResponse = function (serverChanges, callback) { + sync.log.trace("Entering kony.sync.setOTAUploadResponse"); + var isError = false; + if(!kony.sync.isNullOrUndefined(serverChanges.d) && !kony.sync.isNullOrUndefined(serverChanges.d.results)){ + for(var i in serverChanges.d.results){ + kony.sync.OTAChangestobeDeleted.push(serverChanges.d.results[i]); + } + } + function setOTAUploadResponseTransaction(tx) { + sync.log.trace("Entering kony.sync.setOTAUploadResponse->setOTAUploadResponseTransaction"); + isError = kony.sync.applyChanges(tx, kony.sync.currentScope, serverChanges, kony.sync.gPolicy); + } + + function setOTAUploadResponseTransactionSuccess() { + sync.log.trace("Entering kony.sync.setOTAUploadResponse->setOTAUploadResponseTransactionSuccess"); + callback(); + } + function setOTAUploadResponseTransactionFailure() { + sync.log.trace("Entering kony.sync.setOTAUploadResponse->setOTAUploadResponseTransactionFailure"); + if (!isError) { + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } else { + kony.sync.syncUploadFailed(kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var connection = kony.sync.getConnectionOnly(dbname, dbname, kony.sync.syncUploadFailed); + if(connection!==null){ + kony.db.transaction(connection, setOTAUploadResponseTransaction, setOTAUploadResponseTransactionFailure, setOTAUploadResponseTransactionSuccess); + } +}; + +kony.sync.syncUploadFailed = function(connection) { + sync.log.trace("Entering kony.sync.syncUploadFailed"); + kony.sync.onUploadCompletion(true,JSON.stringify(connection)); + sync.log.error("Upload Failed",connection); +}; + + +//To get smallest sequence number from all history tables of a scope +kony.sync.getSmallestSequenceNumber = function(tx){ + sync.log.trace("Entering kony.sync.getSmallestSequenceNumber"); + if(kony.sync.isNullOrUndefined(kony.sync.currentScope.ScopeTables)){ + return -1; + } + var seqNo = -1; //initialize sequence number + for (var i = 0; i < kony.sync.currentScope.ScopeTables.length; i++){ + var syncTable = kony.sync.currentScope.ScopeTables[i]; + //not using query builder to speedup sync time + var sql = "select min(" + kony.sync.historyTableReplaySequenceColumn + ") from " + + syncTable.Name + kony.sync.historyTableName + " where " + + kony.sync.historyTableChangeTypeColumn + " NOT LIKE '9%' AND " + + kony.sync.historyTableSyncVersionColumn + " = " + kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName]; + var resultset = kony.sync.executeSql(tx, sql, null); + if(resultset === false){ + return false; //error occurred while executing query + } + var rowItem = kony.db.sqlResultsetRowItem(tx, resultset, 0); + var seqNoFromTable = kony.sync.tonumber(rowItem["min(" + kony.sync.historyTableReplaySequenceColumn + ")"]); + seqNo = (seqNo === -1 || seqNoFromTable < seqNo) && seqNoFromTable !== null ? seqNoFromTable : seqNo; + } + return seqNo; +}; + +kony.sync.getBatchChanges = function(tx, scope, offset, limit, changeset, lastSeqNo, batchSize) { + sync.log.trace("Entering kony.sync.getBatchChanges"); + var tc = null; + var continueGettingChanges = true; + kony.sync.uploadLimit = 0; + var tempUploadLimit; + do{ + for(var i = 0; !kony.sync.isNull(kony.sync.currentScope.ScopeTables) && i < kony.sync.currentScope.ScopeTables.length; i++){ + var syncTable = kony.sync.currentScope.ScopeTables[i]; + if(kony.sync.isNullOrUndefined(kony.sync.objectLevelInfoMap[syncTable.Name])){ + kony.sync.objectLevelInfoMap[syncTable.Name] = {}; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsUploaded] = 0; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsInserted] = 0; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsUpdated] = 0; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsDeleted] = 0; + + if ((kony.sync.currentScope[kony.sync.syncStrategy] === kony.sync.syncStrategy_OTA)) { + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsInsertedAck] = 0; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsUpdatedAck]= 0; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsDeletedAck] = 0; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsAcknowledged] = 0; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsFailedtoUpload] = 0; + } + + } + + tc = null; + if(kony.sync.isNullOrUndefined(changeset.tables[i])) { + tc = { + tableName: syncTable.Name, + changes: [] + }; + changeset.tables[i] = tc; + } else { + tc = changeset.tables[i]; + } + var fields = []; + if(!kony.sync.isNullOrUndefined(kony.sync.currentScope.ScopeTables[i].Columns)){ + for (var j = 0; j < kony.sync.currentScope.ScopeTables[i].Columns.length; j++) { + var col = kony.sync.currentScope.ScopeTables[i].Columns[j]; + kony.table.insert(fields, col.Name); + } + } + + kony.table.insert(fields, kony.sync.historyTableChangeTypeColumn); + kony.table.insert(fields, kony.sync.historyTableReplaySequenceColumn); + kony.table.insert(fields, kony.sync.historyTableSyncVersionColumn); + kony.table.insert(fields, kony.sync.historyTableHashSumColumn); + + //not using query builder to speedup sync time + var sql = "select * from " + syncTable.Name + kony.sync.historyTableName + " where " + + kony.sync.historyTableChangeTypeColumn + " NOT LIKE '9%' AND " + + kony.sync.historyTableSyncVersionColumn + " = " + kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName] + + " AND " + kony.sync.historyTableReplaySequenceColumn + " between " + offset + " AND " + limit; + + var resultset = kony.sync.executeSql(tx, sql, null); + if(resultset===false){ + return false; + } + prepareChangeSet(tx, resultset); + sync.log.info("changes for " + syncTable.Name + ":", changeset.tables[i].changes); + + sql = "select max(" + kony.sync.historyTableReplaySequenceColumn + ") from " + syncTable.Name + kony.sync.historyTableName + " where " + + kony.sync.historyTableChangeTypeColumn + " NOT LIKE '9%' AND " + + kony.sync.historyTableSyncVersionColumn + " = " + kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName] + + " AND " + kony.sync.historyTableReplaySequenceColumn + " between " + offset + " AND " + limit; + + resultset = kony.sync.executeSql(tx, sql, null); + if(resultset===false){ + return false; + } + tempUploadLimit = kony.db.sqlResultsetRowItem(tx, resultset, 0)["max(" + kony.sync.historyTableReplaySequenceColumn + ")"]; + if(tempUploadLimit !== null && tempUploadLimit > kony.sync.uploadLimit){ + kony.sync.uploadLimit = tempUploadLimit; + } + if(changeset.totalChanges === batchSize){ + break; //got all changes + } + } + if(changeset.totalChanges < batchSize && limit < lastSeqNo){ + offset = limit + 1; + limit += batchSize - changeset.totalChanges; + } + else{ + continueGettingChanges = false; + } + }while(continueGettingChanges); + + function prepareChangeSet(tx, resultset){ + sync.log.trace("Entering kony.sync.getBatchChanges->prepareChangeSet"); + var len = resultset.rows.length; + for (var k = 0; k < len; k++) { + var row = kony.db.sqlResultsetRowItem(tx, resultset, k); + if(!kony.sync.isNullOrUndefined(kony.sync.scopes.syncScopeBlobInfoMap[syncTable.Name])) { + populateBinaryData(tx, row); + } + var changeType = row[kony.sync.historyTableChangeTypeColumn] + ""; + var rc = { + fields: [], + values: [] + }; + if (changeType === kony.sync.insertColStatus) { + rc.changeType = "insert"; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsInserted]=kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsInserted]+1; + kony.sync.syncTotalBatchInserts += 1; + } else if (changeType === kony.sync.updateColStatus) { + rc.changeType = "update"; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsUpdated]=kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsUpdated]+1; + kony.sync.syncTotalBatchUpdates += 1; + } else if (changeType === kony.sync.deleteColStatus) { + rc.changeType = "delete"; + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsDeleted]=kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsDeleted]+1; + kony.sync.syncTotalBatchDeletes += 1; + } + + if(!kony.sync.isNullOrUndefined(syncTable.Columns)){ + for (var x = 0; x < syncTable.Columns.length; x++) { + var column = syncTable.Columns[x]; + if(kony.sync.isNullOrUndefined(row[column.Name]) && (column.Name.indexOf(kony.sync.binaryMetaColumnPrefix) !== 0)){ + kony.table.insert(rc.fields, column.Name); + kony.table.insert(rc.values, "null"); + } + } + } + for(var key in row){ + if (key !== kony.sync.syncStatusColumn){ + kony.table.insert(rc.fields, key); + kony.table.insert(rc.values, row[key]); + } + } + kony.table.insert(tc.changes, rc); + } + changeset.totalChanges = changeset.totalChanges + len; + + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsUploaded] = + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsInserted] + + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsUpdated] + + kony.sync.objectLevelInfoMap[syncTable.Name][kony.sync.numberOfRowsDeleted]; + } + function populateBinaryData(tx, row) { + var binaryColumns = kony.sync.scopes.syncScopeBlobInfoMap[syncTable.Name][kony.sync.columns]; + var binaryColumnName = null; + var binaryMetaFieldKey = null; + for(var i=0; i 0){ + row[binaryColumnName] = base64String[0]; + } else { + //FILE Doesn't exist. + //TODO - throw an error..file doesn't exist. + var valuesTable = {}; + valuesTable.state = kony.sync.blobManager.FILE_DOESNOT_EXIST; + var resultset = kony.sync.blobManager.updateBlobManager(tx, blobIndex, valuesTable, function(err){ + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeTransaction, + kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + }); + if(resultset !== null && resultset !== false) { + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeBlobFileDoesnotExist, + kony.sync.getErrorMessage(kony.sync.errorCodeBlobFileDoesnotExist), null)); + } + } + } else { + //file is in invalid state. + //TODO-throw error..blob in invalid state.. + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeBlobInvalidState, + kony.sync.getErrorMessage(kony.sync.errorCodeBlobInvalidState), null)); + } + } + } else { + //onDemand - do not send data related to the ondemand binary column. + delete row[binaryColumnName]; + } + //delete the blobref column. + delete row[binaryMetaFieldKey]; + } + + function errorCallback(error) { + sync.log.trace(" error occured while fetching blob "); + } + } + sync.log.info("Total number of changes to be uploaded = ", changeset.totalChanges); + return limit; +}; + +//This will update syncorder for Pending uploads +kony.sync.updateSyncOrderForUploadBatching = function(tx, limit){ + sync.log.trace("Entering kony.sync.updateSyncOrderForUploadBatching"); + if(kony.sync.isNullOrUndefined(kony.sync.currentScope.ScopeTables)){ + return true; + } + for (var i = 0; i < kony.sync.currentScope.ScopeTables.length; i++) { + var syncTable = kony.sync.currentScope.ScopeTables[i]; + if(kony.sync.isNullOrUndefined(syncTable)){ + continue; + } + var tablename = syncTable.Name; + var settable = []; + settable[kony.sync.historyTableSyncVersionColumn] = kony.sync.currentSyncScopesState[kony.sync.currentScope.ScopeName] + 1; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, tablename+kony.sync.historyTableName); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, [{key:kony.sync.historyTableReplaySequenceColumn,value:limit, optype: "GT"}]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + return false; + } + } + return true; +}; + +//This method reconciles Foreign key relationships in case of autogenerated pk +kony.sync.reconcileForeignKey = function(tx, setClause, whereClause, tablename){ + sync.log.trace("Entering kony.sync.reconcileForeignKey"); + //Forward Relationships(OneToMany) reconcilation + var OTM = kony.sync.currentScope.syncTableDic[tablename].Relationships.OneToMany; + if(kony.sync.reconcileForeignKeyForRelationShip(tx, setClause, whereClause, tablename, OTM)===false){ + return false; + } + + //Forward Relationships(OneToOne) reconcilation + var OTO = kony.sync.currentScope.syncTableDic[tablename].Relationships.OneToOne; + if(kony.sync.reconcileForeignKeyForRelationShip(tx, setClause, whereClause, tablename, OTO)===false){ + return false; + } + + //Reverse Relationships(ManyToOne) reconcilation + var MTO = kony.sync.currentScope.reverseRelationships[tablename]; + return kony.sync.reconcileForeignKeyForRelationShip(tx, setClause, whereClause, tablename, MTO); +}; + +kony.sync.reconcileForeignKeyForRelationShip = function(tx, setClause, whereClause, tablename, relationshipSet){ + sync.log.trace("Entering kony.sync.reconcileForeignKeyForRelationShip"); + if(!kony.sync.isNullOrUndefined(relationshipSet)){ + for(var i in relationshipSet) { + sync.log.info("Reconciling relationships for object " + tablename + " with relationship ", relationshipSet[i]); + + var setC = {}; + var tbname = relationshipSet[i].TargetObject; + var wcs = []; + if(!kony.sync.isNullOrUndefined(relationshipSet[i].RelationshipAttributes)) + { + var relationshipAttributes = relationshipSet[i].RelationshipAttributes; + for (var j = 0; j < relationshipAttributes.length; j++) { + if(!kony.sync.isNullOrUndefined(setClause[relationshipAttributes[j].SourceObject_Attribute])) { + setC[relationshipAttributes[j].TargetObject_Attribute] = setClause[relationshipAttributes[j].SourceObject_Attribute]; + } + } + + for(var j in whereClause){ + for(var k=0;ksetOTAUploadResponseTransactionFailure"); + if (!isError){ + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } + else{ + kony.sync.syncUploadFailed(kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + var connection = kony.sync.getConnectionOnly(dbname, dbname, transactionErrorCallback); + if(connection!==null){ + kony.db.transaction(connection, transactionCallback, transactionErrorCallback, transactionSuccessCallback); + } +}; + +kony.sync.setLastSyncUploadContext = function(tx, scopename, serverblob) { + sync.log.trace("Entering kony.sync.setLastSyncUploadContext"); + var settable = []; + settable[kony.sync.metaTableUploadSyncTimeColumn] = serverblob; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_update(query, kony.sync.metaTableName); + kony.sync.qb_set(query, settable); + kony.sync.qb_where(query, [{ + key: kony.sync.metaTableScopeColumn, + value: scopename + }, { + key: kony.sync.metaTableFilterValue, + value: "no filter" + }]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params)===false){ + return false; + } +}; + +kony.sync.addLastUploadRequest = function (json, scopename, limit, callback){ + sync.log.trace("Entering kony.sync.addLastUploadRequest"); + var isError = false; + function transactionCallback(tx){ + //check whether failed upload request is already logged + var lastRequest = kony.sync.checkForPendingUpload(tx, scopename); + + //return if query failed, should go to error callback + if(lastRequest===false){ + return; + } + + //return if request already logged, should go to success callback + if(lastRequest!==""){ + return; + } + + var settable = {}; + settable[kony.sync.metaTableScopeColumn] = scopename; + settable[kony.sync.pendingUploadTableInsertCount] = kony.sync.syncTotalInserts; + settable[kony.sync.pendingUploadTableUpdateCount] = kony.sync.syncTotalUpdates; + settable[kony.sync.pendingUploadTableDeleteCount] = kony.sync.syncTotalDeletes; + settable[kony.sync.pendingUploadTableBatchInsertCount] = kony.sync.syncTotalBatchInserts; + settable[kony.sync.pendingUploadTableBatchUpdateCount] = kony.sync.syncTotalBatchUpdates; + settable[kony.sync.pendingUploadTableBatchDeleteCount] = kony.sync.syncTotalBatchDeletes; + settable[kony.sync.pendingUploadTableObjectLevelInfo] = JSON.stringify(kony.sync.objectLevelInfoMap); + settable[kony.sync.pendingUploadTableUploadRequest] = json; + settable[kony.sync.pendingUploadTableUploadLimit] = limit; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_insert(query, kony.sync.pendingUploadTableName); + kony.sync.qb_set(query, settable); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params); + if(resultSet===false){ + isError = true; + } + } + + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.addLastUploadRequest->transactionSuccessCallback"); + callback(true); + } + + function transactionErrorCallback(){ + sync.log.trace("Entering kony.sync.addLastUploadRequest->transactionErrorCallback"); + if (!isError){ + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeTransaction, + kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } + else{ + kony.sync.syncUploadFailed(kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var connection = kony.sync.getConnectionOnly(dbname, dbname, transactionErrorCallback); + if(connection!==null){ + kony.db.transaction(connection, transactionCallback, transactionErrorCallback, transactionSuccessCallback); + } +}; + +kony.sync.deleteLastUploadRequest = function (tx, scopename){ + sync.log.trace("Entering kony.sync.deleteLastUploadRequest"); + var query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, kony.sync.pendingUploadTableName); + kony.sync.qb_where(query, [{key:kony.sync.metaTableScopeColumn, value:scopename}]); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0]; + var params = query_compile[1]; + + if(kony.sync.executeSql(tx, sql, params)===false){ + return false; + } + return true; +}; + +kony.sync.deleteLastUploadRequestWithNewTransaction = function (callback){ + sync.log.trace("Entering kony.sync.deleteLastUploadRequestWithNewTransaction"); + var isError = false; + function transactionCallback(tx){ + if(kony.sync.deleteLastUploadRequest(tx, kony.sync.currentScope[kony.sync.scopeName])===false){ + isError = true; + } + } + + function transactionSuccessCallback(){ + sync.log.trace("Entering kony.sync.deleteLastUploadRequestWithNewTransaction->transactionSuccessCallback"); + callback(true); + } + + function transactionErrorCallback(){ + sync.log.trace("Entering kony.sync.deleteLastUploadRequestWithNewTransaction->transactionErrorCallback"); + if (!isError){ + kony.sync.syncUploadFailed(kony.sync.getErrorTable(kony.sync.errorCodeTransaction, kony.sync.getErrorMessage(kony.sync.errorCodeTransaction), null)); + } + else{ + kony.sync.syncUploadFailed(kony.sync.errorObject); + kony.sync.errorObject = null; + } + } + var dbname = kony.sync.currentScope[kony.sync.scopeDataSource]; + var connection = kony.sync.getConnectionOnly(dbname, dbname, transactionErrorCallback); + if(connection!==null){ + kony.db.transaction(connection, transactionCallback, transactionErrorCallback, transactionSuccessCallback); + } +}; +// **************** End KonySyncUpload.js******************* + + +// **************** Start KonySyncValidations.js******************* +if (typeof(kony.sync) === "undefined") { + kony.sync = {}; +} +kony.sync.attributeValidation = function(valuestable, tablename, errorcallback, isInsert){ + sync.log.trace("kony.sync.attributeValidation ", valuestable); + if(!kony.sync.enableORMValidations){ + return true; + } + if(valuestable != null){ + var scope = kony.sync.scopes[kony.sync.scopes.syncTableScopeDic[tablename]]; + var columns = scope.syncTableDic[tablename].ColumnsDic; + kony.sync.filterAttributes(valuestable, columns, tablename, isInsert); + var expectedType = null; + var expectedLength = null; + var jsType = null; + for(var key in columns){ + expectedType = columns[key].type; + expectedLength = columns[key].Length; + jsType = kony.sync.getJSType(expectedType); + //Type validation + sync.log.debug("kony.sync.attributeValidation:Starting Type Validations"); + if(jsType === "number" || jsType === "boolean"){ + if(!kony.sync.isEmptyString(valuestable[key])){ + if(!kony.sync.isNull(valuestable[key]) && jsType === "number" && !kony.sync.isValidNumberType(valuestable[key])){ + sync.log.error("Invalid data type for the attribute " + key + " in " + tablename + ".\nExpected:\"" + expectedType + "\"\nActual:\"" + kony.type(valuestable[key]) + "\""); + errorcallback(kony.sync.getErrorTable(kony.sync.errorCodeInvalidDataType,kony.sync.getInvalidDataTypeMsg(tablename, key, expectedType, kony.type(valuestable[key])))); + return false; + } + if(!kony.sync.isNull(valuestable[key]) && jsType === "boolean" && !kony.sync.isValidBooleanType(valuestable[key])){ + sync.log.error("Invalid data type for the attribute " + key + " in " + tablename + ".\nExpected:\"" + expectedType + "\"\nActual:\"" + kony.type(valuestable[key]) + "\""); + errorcallback(kony.sync.getErrorTable(kony.sync.errorCodeInvalidDataType,kony.sync.getInvalidDataTypeMsg(tablename, key, expectedType, kony.type(valuestable[key])))); + return false; + } + }else { + valuestable[key] = "null"; + } + } + sync.log.debug("kony.sync.attributeValidation:Type Validations done"); + //Malicious type validation + sync.log.debug("kony.sync.attributeValidation:Starting Malicious Validations"); + if(jsType === "number" || typeof(valuestable[key]) === "number"){ + var maliciousType=kony.sync.isMaliciousType(valuestable[key]); + if(maliciousType!== false){ + var errorMessage = kony.sync.getErrorMessage(kony.sync.errorCodeMaliciousType, key, maliciousType); + sync.log.error("Malicious object detected", kony.sync.getErrorTable(kony.sync.errorCodeMaliciousType, errorMessage)); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeMaliciousType, errorMessage)); + return false; + } + } + sync.log.debug("kony.sync.attributeValidation:Malicious Validations done"); + //Length Validation + sync.log.debug("kony.sync.attributeValidation:Starting Length Validations"); + if(jsType === "string"){ + if(kony.sync.validateLength(tablename, key, valuestable[key], expectedLength, errorcallback)===false){ + return false; + } + } + sync.log.debug("kony.sync.attributeValidation:Length Validations done"); + //Mandatory Attribute Validation + sync.log.debug("kony.sync.attributeValidation:Starting Mandatory Attribute Validations"); + // if(columns[key].IsNullable === false && !(columns[key].Autogenerated === "true") && !(isInsert===false && columns[key].IsPrimaryKey===true)){ + // if(kony.sync.validateMandatoryColumns(tablename, key, valuestable[key], errorcallback)===false){ + // return false; + // } + // } + if(isInsert){ + //check all mandatory attributes + if(columns[key].IsNullable === false){ + if(columns[key].Autogenerated !== "true"){ + if(kony.sync.validateMandatoryColumns(tablename, key, valuestable[key], errorcallback)===false){ + return false; + } + } + } + } + else{ + //check mandatory attributes only if they are defined + if(columns[key].IsNullable === false){ + if(columns[key].Autogenerated !== "true"){ + if(typeof(valuestable[key])!=="undefined"){ + if(kony.sync.validateMandatoryColumns(tablename, key, valuestable[key], errorcallback)===false){ + return false; + } + } + } + } + } + + sync.log.debug("kony.sync.attributeValidation:Mandatory Attribute Validations done"); + } + } + + return true; +}; + + +kony.sync.filterAttributes = function(valuestable, attributeTable, tablename, isInsert){ + for (var k in valuestable){ + if(kony.sync.isNull(attributeTable[k])){ + sync.log.warn("Ignoring the attribute " + k + " for the SyncObject " + tablename + ". " + k + " is not defined as an attribute in SyncConfiguration."); + delete valuestable[k]; + }else if(attributeTable[k].IsPrimaryKey){ + if(isInsert === false){ + sync.log.warn("Ignoring the primary key " + k + " for the SyncObject " + tablename + ". Primary Key should not be the part of the attributes to be updated in the local device database."); + delete valuestable[k]; + }else if(attributeTable[k].Autogenerated === "true"){ + sync.log.warn("Ignoring the auto-generated primary key " + k + " for the SyncObject " + tablename + ". Auto-generated Primary Key should not be the part of the attributes to be inserted in the local device database."); + delete valuestable[k]; + } + } + } +}; + +kony.sync.getJSType = function(myType){ + myType = myType.toLowerCase(); + var stringTypes = { + "string" : true, + "character" : true, + "java.lang.String" : true, + "char" : true + }; + var numberTypes = { + "int" : true, + "double" : true, + "float" : true, + "long" : true, + "short" : true, + "integer" : true, + "big_decimal" : true, + "byte" : true, + "big_integer" : true + }; + var booleanTypes = { + "boolean" : true, + "yes_no" : true + }; + if(stringTypes[myType] === true) { + return "string"; + } + if (numberTypes[myType] === true) { + return "number"; + } + if (booleanTypes[myType] === true) { + return "boolean"; + } + return null; +}; + +kony.sync.validateLength = function (tablename, colname, colvalue, length, errorcallback) { + sync.log.trace("Entering kony.sync.validateLength "); + if (!kony.sync.isNull(colvalue) && kony.string.equalsIgnoreCase(kony.type(colvalue), "string") && kony.string.len(colvalue) > length) { + sync.log.error("Length exceeds the limit for the attribute " + colname + " in " + tablename + ".\nExpected:\'" + length + "\'\nActual:\'" + kony.string.len(colvalue) + "\'"); + kony.sync.verifyAndCallClosure(errorcallback, kony.sync.getErrorTable(kony.sync.errorCodeLengthValidationFailed, kony.sync.getValidateLengthErrMsg(tablename, colname, length, kony.string.len(colvalue)))); + return false; + } + return true; +}; + +kony.sync.validateMandatoryColumns = function(tablename, colname, colvalue, errorcallback){ + sync.log.trace("Entering Address.validateNullInsert function"); + if(kony.sync.isNull(colvalue)){ + sync.log.error("Mandatory attribute " + colname + " is missing for the SyncObject" + tablename + "."); + errorcallback(kony.sync.getErrorTable(kony.sync.errorCodeMandatoryAttribute,kony.sync.getErrorMessage(kony.sync.errorCodeMandatoryAttribute, tablename, colname))); + return false; + } + return true; +}; + + +kony.sync.isSyncInitialized = function (errorcallback) { + sync.log.trace("Entering kony.sync.isSyncInitialized"); + if (!kony.sync.syncInitialized) { + sync.log.error("Please initialize sync by calling sync.init"); + kony.sync.alert("Please initialize sync by calling sync.init"); + kony.sync.verifyAndCallClosure(errorcallback, {}); + return false; + } + return true; +}; + +kony.sync.validateInput = function (input, objectName, ormType, errorcallback) { + sync.log.trace("Entering kony.sync.validateInput"); + if (ormType === "create") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validatePrimaryKeyField(objectName, ormType, input[0], errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "updateByPk") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 2)) { + if (!kony.sync.validatePrimaryKeyField(objectName, ormType, input[0], errorcallback)) { + return false; + } + if (!kony.sync.validateInputField(objectName, ormType, input[1], "object", errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "update") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 2)) { + if (!kony.sync.validateInputField(objectName, ormType, input[0], "string", errorcallback)) { + return false; + } + if (!kony.sync.validateInputField(objectName, ormType, input[1], "object", errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "getCount") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validateInputField(objectName, ormType, input[0], "string", errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "createAll") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validateInputField(objectName, ormType, input[0], "object", errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "updateAll") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validateInputField(objectName, ormType, input[0], "object", errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "deleteByPK") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validatePrimaryKeyField(objectName, ormType, input[0], errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "remove") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validateInputField(objectName, ormType, input[0], "string", errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "removeDeviceInstanceByPK") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validatePrimaryKeyField(objectName, ormType, input[0], errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "getAllDetailsByPK") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validatePrimaryKeyField(objectName, ormType, input[0], errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "find") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validateInputField(objectName, ormType, input[0], "string", errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "markForUploadbyPK") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validatePrimaryKeyField(objectName, ormType, input[0], errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "markForUpload") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validateInputField(objectName, ormType, input[0], "string", errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "rollbackPendingLocalChangesByPK") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validatePrimaryKeyField(objectName, ormType, input[0], errorcallback)) { + return false; + } + } else { + return false; + } + }else if (ormType === "relationship") { + if (kony.sync.validateArgumentLength(objectName, ormType, input.length, 1)) { + if (!kony.sync.validatePrimaryKeyField(objectName, ormType, input[0], errorcallback)) { + return false; + } + } else { + return false; + } + } + return true; +}; + + +kony.sync.validatePrimaryKeyField = function(objName, opType, inputAttribute, errorcallback) { + sync.log.trace("Entering kony.sync.validatePrimaryKeyField"); + if (kony.sync.isNullOrUndefined(inputAttribute)) { + kony.sync.verifyAndCallClosure(errorcallback, "Argument type mismatch found for operation:" + objName + ". Expected 'integer, string or object ' Actual null or undefined '"); + kony.sync.alert("Argument type mismatch found for operation:" + objName + ". Expected 'integer, string or object' Actual 'null or undefined'"); + return false; + } + var actualType = typeof(inputAttribute); + if(!(actualType === "number" || actualType === "string" || actualType === "object")){ + kony.sync.verifyAndCallClosure(errorcallback, "Argument type mismatch found for Primary Key in operation:" + objName + ". Expected 'integer, string or object' Actual '" + actualType + "'"); + kony.sync.alert("Argument type mismatch found for operation:" + objName + ". Expected 'integer, string or object' Actual '" + actualType + "'"); + return false; + } + return true; +}; + + +kony.sync.validateInputField = function (objName, opType, inputAttribute, expectedType, errorcallback) { + sync.log.trace("Entering kony.sync.validateInputField"); + if (kony.sync.isNullOrUndefined(inputAttribute)) { + kony.sync.verifyAndCallClosure(errorcallback, "Argument type mismatch found for operation:" + objName + ". Expected '" + expectedType + "' Actual 'null or undefined '"); + kony.sync.alert("Argument type mismatch found for operation:" + objName + ". Expected '" + expectedType + "' Actual 'null or undefined'"); + return false; + } + var actualType = typeof(inputAttribute); + if (actualType !== expectedType) { + kony.sync.verifyAndCallClosure(errorcallback, "Argument type mismatch found for operation:" + objName + ". Expected '" + expectedType + "' Actual '" + actualType + "'"); + kony.sync.alert("Argument type mismatch found for operation:" + objName + ". Expected '" + expectedType + "' Actual '" + actualType + "'"); + return false; + } + return true; +}; + +kony.sync.validateArgumentLength = function (objName, ormType, actualLength, expectedLength) { + sync.log.trace("Entering kony.sync.validateArgumentLength"); + if (actualLength < expectedLength) { + kony.sync.alert("Insufficient number of arguments passed for operation: " + objName); + return false; + } + return true; +}; + +kony.sync.alert = function(msg){ + if(kony.sync.isAlertEnabled){ + alert(msg); + } + else{ + kony.print(msg); + } +}; +// **************** End KonySyncValidations.js******************* + + diff --git a/SegementAnimation/modules/animations.js b/SegementAnimation/modules/animations.js new file mode 100644 index 0000000..240ca1d --- /dev/null +++ b/SegementAnimation/modules/animations.js @@ -0,0 +1,136 @@ +function animateLoginWidget1(){ + kony.print("\nin animateLoginWidget1"); + frmLogin.loginContainer.animate( + kony.ui.createAnimation({ + // 0:{top:"90%","stepConfig":{}}, + 100:{top:"0%","stepConfig":{}} + }), + {delay:0,fillMode:kony.anim.FILL_MODE_FORWARDS,duration:0.3}, + {animationEnd: function() {}} + ); +} + +function removeRestaurents(){ +frmHome.segmentRestaurentList.removeAll(); + //setRestaurents(); +} +function setRestaurents(){ + var addRowAnim; + var resObj,resList=[]; + getRestaurents(); + var len=response["results"].length; + // alert("length:-"+len); + for(var i=0;i konyRef.claimTokenExpiry) { + if (konyRef.isAnonymousProvider) { + loginWithAnonymousProvider(callback, failureCallback); + } else { + logger.log("claims token has expired. fetching new token..") + var _serviceUrl = stripTrailingCharacter(konyRef.rec.url, "/"); + var _url = _serviceUrl + "/claims"; + logger.log("service url is " + _url); + if (konyRef.currentRefreshToken === null) { + kony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getNullRefreshTokenErrObj()); + } else { + networkProvider.post(_url, {}, { + "Authorization": konyRef.currentRefreshToken, + "Content-Type": "application/x-www-form-urlencoded" + }, function(tokens) { + logger.log("refresh success..acquiring new tokens"); + kony.sdk.processClaimsSuccessResponse(tokens,konyRef,true,callback); + }, + function(data) { + logger.log("failed to acquire refresh token"); + kony.sdk.processClaimsErrorResponse(data,konyRef,true,failureCallback); + }); + } + } + } else { + callback(); + } +}; + +kony.sdk.processClaimsSuccessResponse=function(data,konyRef,isAsync,callBack){ + data = kony.sdk.formatSuccessResponse(data); + konyRef.currentClaimToken = data.claims_token.value; + konyRef.claimTokenExpiry = data.claims_token.exp; + konyRef.currentRefreshToken = data.refresh_token; + if(!isAsync){ + return { "message" :"success"}; + } + else if(callBack){ + callBack(); + } +} +kony.sdk.processClaimsErrorResponse=function(data,konyRef,isAsync,callBack){ + /*reset the claims token*/ + konyRef.currentClaimToken = null; + konyRef.claimTokenExpiry = null; + konyRef.currentRefreshToken = null; + //setting the anonymous provider as true to access the public protected urls without any issue + konyRef.isAnonymousProvider = true; + if(!isAsync){ + return kony.sdk.error.getAuthErrObj(data); + } + else if(callBack){ + kony.sdk.verifyAndCallClosure(callBack, kony.sdk.error.getAuthErrObj(data)); + } +} +kony.sdk.prototype.setIntegrationServiceEndpoint = function(serviceName, endPoint) { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before this, else your changes will be overridden when init is called"); + } + var konyRef = kony.sdk.getCurrentInstance(); + if (!konyRef.integsvc) { + throw new Exception(Errors.INTEGRATION_FAILURE, "no valid integration services available"); + } + if (!konyRef.integsvc[serviceName]) { + throw new Exception(Errors.INTEGRATION_FAILURE, "no valid integration services available for " + serviceName); + } + konyRef.integsvc[serviceName] = endPoint; +}; + +kony.sdk.prototype.setObjectServiceEndpoint = function(serviceName, endPoint) { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before this, else your changes will be overridden when init is called"); + } + var konyRef = kony.sdk.getCurrentInstance(); + if (!konyRef.objectsvc) { + throw new Exception(Errors.OBJECT_FAILURE, "no valid Object services available"); + } + if (!konyRef.objectsvc[serviceName]) { + throw new Exception(Errors.OBJECT_FAILURE, "no valid Object services available for " + serviceName); + } + konyRef.objectsvc[serviceName] = endPoint; +}; + +kony.sdk.prototype.setAuthServiceEndpoint = function(providerName, endPoint) { + + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before this, else your changes will be overridden when init is called"); + } + + var konyRef = kony.sdk.getCurrentInstance(); + + if (!konyRef.login) { + throw new Exception(Errors.AUTH_FAILURE, "no valid authentication services available"); + } + + var i = 0; + for (i = 0; i < konyRef.login.length; i++) { + var rec = konyRef.login[i]; + if (rec.prov.toUpperCase() === providerName.toUpperCase()) { + break; + } + } + + if (i === konyRef.login.length) { + throw new Exception(Errors.AUTH_FAILURE, "no valid authentication services available for " + providerName); + } + + konyRef.login[i].url = endPoint; +}; + +kony.sdk.prototype.setSyncServiceEndpoint = function(endPoint) { + + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before this, else your changes will be overridden when init is called"); + } + + var konyRef = kony.sdk.getCurrentInstance(); + + if (!konyRef.sync) { + throw new Exception(Errors.SYNC_FAILURE, "no valid sync services available"); + } + + //assuming only one sync service per app + konyRef.sync.url = endPoint; +} + +kony.sdk.prototype.setReportingServiceEndPoint = function(serviceType, endPoint) { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before this, else your changes will be overridden when init is called"); + } + + var konyRef = kony.sdk.getCurrentInstance(); + if (!serviceType) { + throw new Exception(Errors.METRICS_FAILURE, serviceType + " is not a valid reporting service"); + } + serviceType = serviceType.toLowerCase(); + if (serviceType === "custom") { + konyRef.customReportingURL = endPoint; + } else if (serviceType === "session") { + konyRef.sessionReportingURL = endPoint; + } else { + throw new Exception(Errors.METRICS_FAILURE, serviceType + " is not a valid reporting service"); + } +} + +kony.sdk.prototype.setMessagingServiceEndPoint = function(endPoint) { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before this, else your changes will be overridden when init is called"); + } + + var konyRef = kony.sdk.getCurrentInstance(); + + if (!konyRef.messagingsvc) { + throw new Exception(Errors.MESSAGING_FAILURE, "no valid reporting services available"); + } + + konyRef.messagingsvc.url = endPoint; +} + +/** + * Init success callback method. + * @callback initSuccessCallback + * @param {json} mainRef - Application Configuration + */ + +/** + * Init failure callback method. + * @callback initFailureCallback + */ + +/** + * Initialization method for the kony SDK. + * This method will fetch the app configuration from the kony server and stores in memory. + * This method has to be invoked before invoking any other SDK methods. + * @param {string} appKey - Appkey of the kony application + * @param {string} appSecret - App Secret of the kony application + * @param {string} serviceUrl - URL of the kony Server + * @param {initSuccessCallback} successCallback - Callback method on success + * @param {initFailureCallback} failureCallback - Callback method on failure + */ +kony.sdk.prototype.init = function(appKey, appSecret, serviceUrl, successCallback, failureCallback) { + var logger = new konyLogger(); + if (!(appKey && appSecret && serviceUrl)) { + logger.log("### init:: Invalid credentials passed"); + kony.sdk.verifyAndCallClosure(failureCallback, "Invalid initialization parameters passed. Please check appKey, appSecret and ServiceUrl parameters"); + return; + } + var networkProvider = new konyNetworkProvider(); + serviceUrl = serviceUrl.trim(); + this.mainRef.serviceUrl = serviceUrl; + var konyRef = this; + + logger.log("### init:: calling GET on appConfig to retrieve servicedoc"); + + networkProvider.post( + serviceUrl, + null, { + "X-Kony-App-Key": appKey, + "X-Kony-App-Secret": appSecret, + "X-HTTP-Method-Override": "GET" + }, + function(data) { + data = kony.sdk.formatSuccessResponse(data); + logger.log("### init::_doInit fetched servicedoc successfuly"); + logger.log("### init:: retrieved data from service doc"); + logger.log(data); + konyRef.mainRef.config = data; + konyRef.servicedoc = data; + konyRef.mainRef.appId = data.appId; + var processServiceDocResult = konyRef.initWithServiceDoc(appKey, appSecret, data); + if (processServiceDocResult === true) { + logger.log("### init::_doInit processing service document successful"); + var svcDataStr = JSON.stringify(data); + logger.log("### init::_doInit saving done. Calling success callback"); + kony.sdk.initiateSession(konyRef); + var identityObject = kony.sdk.getCurrentInstance().getIdentityService("$anonymousProvider"); + identityObject.login(null, + function(res) { + kony.sdk.verifyAndCallClosure(successCallback, konyRef.mainRef); + }, + function(res) { + kony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getAuthErrObj(res)); + }); + } else { + logger.log("### init::_doInit processing servicedoc failed. Calling failure callback"); + kony.sdk.verifyAndCallClosure(failureCallback, JSON.stringify(processServiceDocResult)); + } + }, + function(data) { + logger.log("### init::_doInit fetching service document from Server failed" + data); + logger.log("### init::_doInit calling failure callback"); + kony.sdk.isInitialized = false; + kony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getAuthErrObj(data)); + }); +}; + + +kony.sdk.prototype.initWithServiceDoc = function(appKey, appSecret, serviceDoc) { + konyRef = this; + kony.sdk.currentInstance = this; + if (serviceDoc instanceof kony.sdk.serviceDoc) { + var servConfig = serviceDoc.toJSON(); + processServiceDocMap(servConfig); + } else { + return processServiceDocMap(serviceDoc); + } + + function processServiceDocMap(servConfig) { + var logger = new konyLogger(); + + + for (var item in servConfig) { + if (kony.sdk.isEmptyObject(servConfig[item])) { + delete servConfig[item]; + } + } + + logger.log("### init::_doInit::_processServiceDoc" + JSON.stringify(servConfig)); + try { + konyRef.mainRef.appKey = appKey; + konyRef.mainRef.appSecret = appSecret; + konyRef.mainRef.appId = servConfig.appId; + + /* if (!servConfig.baseId) { + throw new Exception(Errors.INIT_FAILURE, "invalid baseId " + servConfig.baseId); + } */ + konyRef.mainRef.baseId = servConfig.baseId; + + /* if (!servConfig.name) { + throw new Exception(Errors.INIT_FAILURE, "invalid name " + servConfig.name); + } */ + konyRef.mainRef.name = servConfig.name; + + if (servConfig.login) { + konyRef.login = servConfig.login; + } else { + konyRef.login = []; + } + + var url = servConfig.selflink; + if (url) { + var lastPos = url.indexOf("/appconfig"); + if (lastPos != -1) { + url = url.slice(0, lastPos); + } else { + throw new Exception(Errors.INIT_FAILURE, "invalid self link"); + } + var anonymousLoginProvider = {}; + anonymousLoginProvider.type = "anonymous"; + anonymousLoginProvider.url = url; + anonymousLoginProvider.prov = "$anonymousProvider"; + konyRef.login.push(anonymousLoginProvider); + } + + if (typeof(servConfig.integsvc) !== 'undefined') { + logger.log("### init::_doInit::_processServiceDoc parsing Integration services"); + konyRef.integsvc = servConfig.integsvc; + logger.log("### init::_doInit::konyRef integration Services" + JSON.stringify(konyRef.integsvc)); + } + + if (typeof(servConfig.objectsvc) !== 'undefined') { + logger.log("### init::_doInit::_processServiceDoc parsing Object services"); + konyRef.objectsvc = servConfig.objectsvc; + logger.log("### init::_doInit::konyRef object Services" + JSON.stringify(konyRef.objectsvc)); + } + + if (typeof(servConfig.messagingsvc) !== 'undefined') { + logger.log("### init::_doInit::_processServiceDoc parsing Messaging services"); + konyRef.messagingsvc = servConfig.messagingsvc; + } + + if (typeof(servConfig.sync) !== 'undefined') { + konyRef.sync = servConfig.sync; + } + if(kony.sdk.isLicenseUrlAvailable) { + if (servConfig.reportingsvc && servConfig.reportingsvc.custom && servConfig.reportingsvc.session) { + konyRef.customReportingURL = servConfig.reportingsvc.custom; + konyRef.sessionReportingURL = servConfig.reportingsvc.session; + } else { + throw new Exception(Errors.INIT_FAILURE, "invalid url for reporting service"); + } + } + + if (konyRef.internalSdkObject) { + konyRef.internalSdkObject.initWithServiceDoc(appKey, appSecret, servConfig); + if (konyRef.internalSdkObject.setClientParams) { + konyRef.internalSdkObject.setClientParams(konyRef.getClientParams()); + } + logger.log("### init::internal sdk object initialized"); + } + logger.log("### init::_doInit::_processServiceDoc parsing service document done"); + kony.sdk.isInitialized = true; + konyRef.setCurrentUserId(""); + if (kony.sdk.metric) { + kony.sdk.metric.flushEvents(); + } + return true; + } catch (err) { + logger.log("### init::_doInit::_processServiceDoc failed with an exception: " + err); + return ("processing the ServiceDoc failed with an exception: " + JSON.stringify(err)); + } + + } + +}; + +kony.sdk.prototype.sessionChangeHandler = function(changes) { + + var konyRef = kony.sdk.getCurrentInstance(); + var sessionId = null; + var userId = null; + if (changes["sessionId"] != undefined) { + sessionId = changes["sessionId"]; + konyRef.setSessionId(sessionId); + if (konyRef.metricsServiceObject && konyRef.metricsServiceObject.setSessionId) { + konyRef.metricsServiceObject.setSessionId(sessionId); + } + } + if (changes["userId"] != undefined) { + userId = changes["userId"]; + konyRef.setCurrentUserId(userId); + if (konyRef.metricsServiceObject && konyRef.metricsServiceObject.setUserId) { + konyRef.metricsServiceObject.setUserId(userId); + } + } + // if (konyRef.internalSdkObject) { + // //TODO implement across native sdk's ios/andriod + // //konyRef.internalSdkObject.sessionChangeHandler(changes); + // if(sessionId) { + // konyRef.internalSdkObject.setSessionId(sessionId); + // } + // if(userId) { + // konyRef.internalSdkObject.setUserId(userId); + // } + // } +}; + + +if (typeof(kony.sdk) === "undefined") { + kony.sdk = {}; +} + +if (typeof(kony.sdk.error) === "undefined") { + kony.sdk.error = {}; +} + +kony.sdk.error.getAuthErrObj = function(errResponse) { + if (errResponse && errResponse.httpresponse) { + delete errResponse.httpresponse; + } + if (errResponse && (errResponse.opstatus == 1013 || errResponse.opstatus == 1011)) { + errResponse["message"] = errResponse["errmsg"]; + delete errResponse.errmsg; + } + try { + var mfcode = errResponse["mfcode"]; + var message = errResponse["message"]; + var details = errResponse["details"]; + if (mfcode) { + return kony.sdk.error.getMFcodeErrObj(mfcode, message, details, ""); + } + return errResponse; + } catch (err) { + return errResponse; + } +} + +kony.sdk.error.getNullClaimsTokenErrObj = function() { + var errorObj = {}; + //TODO move error code and constants in to constants. + errorObj.opstatus = kony.sdk.errorcodes.cliams_token_null + errorObj.message = kony.sdk.errormessages.cliams_token_null + errorObj.details = {}; + errorObj.mfcode = ""; + return errorObj; +} + +kony.sdk.error.getNullRefreshTokenErrObj = function() { + var errorObj = {}; + //TODO move error code and constants in to constants. + errorObj.opstatus = kony.sdk.errorcodes.invalid_session_or_token_expiry + errorObj.message = kony.sdk.errormessages.invalid_session_or_token_expiry + errorObj.details = {}; + errorObj.mfcode = ""; + return errorObj; +} + +kony.sdk.error.getIntegrationErrObj = function(errResponse) { + try { + var mfcode = errResponse["mfcode"]; + var message = errResponse["errmsg"]; + var details = errResponse["mferrmsg"]; + var service = errResponse["service"]; + if (!service) { + service = ""; + } + if (!details) { + details = ""; + } + var errorMessagePrefixForIntegration = ""; + if (service) { + errorMessagePrefixForIntegration = "Integration Service Request Failed for " + service + ":"; + } else { + errorMessagePrefixForIntegration = "Integration Service Request Failed:"; + } + if (mfcode) { + return kony.sdk.error.getMFcodeErrObj(mfcode, message, details, errorMessagePrefixForIntegration); + } + return errResponse; + } catch (err) { + return errResponse; + } +} + +kony.sdk.error.getMFcodeErrObj = function(mfcode, message, details, errMessagePrefix) { + var errorObj = {}; + errorObj.details = {}; + if (details) { + errorObj.details = details; + } + errorObj.mfcode = mfcode; + if (mfcode === "Auth-4") { + if (!message) { + message = kony.sdk.errormessages.invalid_user_credentials + } + errorObj.opstatus = kony.sdk.errorcodes.invalid_user_credentials + errorObj.message = errMessagePrefix + message; + + } else if (mfcode === "Auth-9") { + if (!message) { + message = kony.sdk.errormessages.invalid_app_credentials + } + errorObj.opstatus = kony.sdk.errorcodes.invalid_app_credentials + errorObj.message = errMessagePrefix + message; + } else if (mfcode === "Auth-3") { + if (!message) { + message = kony.sdk.errormessages.invalid_user_app_credentials + } + errorObj.opstatus = kony.sdk.errorcodes.invalid_user_app_credentials + errorObj.message = errMessagePrefix + message; + } else if ((mfcode === "Auth-5") || (mfcode === "Auth-6") || (mfcode === "Gateway-31") || (mfcode === "Gateway-33") || (mfcode === "Gateway-35") || (mfcode === "Gateway-36") || (mfcode === "Auth-46") || (mfcode === "Auth-55")) { + errorObj.opstatus = kony.sdk.errorcodes.invalid_session_or_token_expiry + errorObj.message = errMessagePrefix + kony.sdk.errormessages.invalid_session_or_token_expiry + } else if (mfcode === "Auth-7" || mfcode === "Auth-27") { + if (!message) { + message = errMessagePrefix + kony.sdk.errormessages.invalid_user_app_services + } + errorObj.opstatus = kony.sdk.errorcodes.invalid_user_app_services + errorObj.message = message; + } else { + errorObj.opstatus = kony.sdk.errorcodes.default_code + errorObj.message = errMessagePrefix + kony.sdk.errormessages.default_message + } + return errorObj; +} + +function getAuthErrorMessage(mfcode) { + if (mfcode === "Auth-4") { + return kony.sdk.errormessages.invalid_user_credentials + } else if (mfcode === "Auth-9") { + return kony.sdk.errormessages.invalid_app_credentials + } else if (mfcode === "Auth-3") { + return kony.sdk.errormessages.invalid_user_app_credentials + } else if ((mfcode === "Auth-5") || (mfcode === "Auth-6") || (mfcode === "Gateway-31") || (mfcode === "Gateway-33") || (mfcode === "Gateway-35") || (mfcode === "Gateway-36") || (mfcode === "Auth-46") || (mfcode === "Auth-55")) { + return kony.sdk.errormessages.invalid_session_or_token_expiry + } else if (mfcode === "Auth-7" || mfcode === "Auth-27") { + return kony.sdk.errormessages.invalid_user_app_services + } else { + return mfcode + ":" + kony.sdk.errormessages.default_message + } +} + +kony.sdk.error.getObjectServiceErrObj = function(errResponse) { + try { + var mfcode = errResponse["mfcode"]; + var message = errResponse["errmsg"]; + var details = errResponse["mferrmsg"]; + var service = errResponse["service"]; + if (!service) { + service = ""; + } + if (!details) { + details = ""; + } + var errorMessagePrefixForIntegration = ""; + if (service) { + errorMessagePrefixForIntegration = "Object Service Request Failed for " + service + ":"; + } else { + errorMessagePrefixForIntegration = "Object Service Request Failed:"; + } + + if (mfcode) { + return kony.sdk.error.getMFcodeErrObj(mfcode, message, details, errorMessagePrefixForIntegration); + } + return errResponse; + } catch (err) { + return errResponse; + } +} +if (typeof(kony.sdk) === "undefined") { + kony.sdk = {}; +} + +if (typeof(kony.sdk.errorcodes) === "undefined") { + kony.sdk.errorcodes = {}; +} + +if (typeof(kony.sdk.errormessages) === "undefined") { + kony.sdk.errormessages = {}; +} + +kony.sdk.errorcodes.invalid_user_credentials = 101; +kony.sdk.errormessages.invalid_user_credentials = "Invalid User Credentials."; + +kony.sdk.errorcodes.invalid_app_credentials = 102; +kony.sdk.errormessages.invalid_app_credentials = "Invalid App Credentials."; + +kony.sdk.errorcodes.invalid_user_app_credentials = 103; +kony.sdk.errormessages.invalid_user_app_credentials = "Invalid User/App Credentials."; + +kony.sdk.errorcodes.invalid_session_or_token_expiry = 104; +kony.sdk.errormessages.invalid_session_or_token_expiry = "Session/Token got invalidated in the backend.Please login."; + +kony.sdk.errorcodes.invalid_user_app_services = 105; +kony.sdk.errormessages.invalid_user_app_services = "Invalid provider in appServices."; + +kony.sdk.errorcodes.cliams_token_null = 106; +kony.sdk.errormessages.cliams_token_null = "Claims Token is Unavialable"; + +kony.sdk.errorcodes.default_code = 100; +kony.sdk.errormessages.default_message = "UnhandledMFcode"; + +kony.sdk.errorcodes.unknown_error_code = 1000; +kony.sdk.errormessages.unknown_error_message = "An unknown error has occured"; + +kony.sdk.errorcodes.connectivity_error_code = 1011; +kony.sdk.errormessages.connectivity_error_message = "An error occurred while making the request. Please check device connectivity, server url and request parameters"; + +kony.sdk.errorcodes.invalid_json_code = 1013; +kony.sdk.errormessages.invalid_json_message = "Invalid Json response was returned"; + +kony.sdk.errorcodes.request_timed_out_code = 1014; +kony.sdk.errormessages.request_timed_out_message = "Request to server has timed out"; + +kony.sdk.errorcodes.offline_auth_failed = 1015; +kony.sdk.errormessages.offline_auth_failed = "Offline Authentication failed, User should atleast login once when network connectivity is available." + + +kony.sdk.errorcodes.servicedoc_unavailable= 1016; +kony.sdk.errormessages.servicedoc_unavailable = "MBAAS app is not initialized properly. Service document is unavailable." +/** + * Method to create the Identity service instance with the provided provider name. + * @param {string} providerName - Name of the provider + * @returns {IdentityService} Identity service instance + */ + + kony.sdk.offline = kony.sdk.offline || {}; + +kony.sdk.prototype.getIdentityService = function(providerName) { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + var logger = new konyLogger(); + var provider = null; + if (providerName) { + if (this.login != null) { + for (var i = 0; i < this.login.length; i++) { + var rec = this.login[i]; + if ((rec.alias && rec.alias.toUpperCase() === providerName.toUpperCase()) || (rec.prov.toUpperCase() === providerName.toUpperCase())) { + provider = new IdentityService(this, rec); + break; + } + + } + if (provider === null) { + throw new Exception(Errors.AUTH_FAILURE, "Invalid providerName"); + } + //TODO: what if the providerName is not passed by the user? + logger.log("### auth:: returning authService for providerName = " + provider.getProviderName()); + return provider; + } + } else { + throw new Exception(Errors.AUTH_FAILURE, "Invalid providerName"); + } +}; +/** + * Should not be called by the developer. + * @class + * @classdesc Identity service instance for handling login/logout calls. + */ +function IdentityService(konyRef, rec) { + var logger = new konyLogger(); + var networkProvider = new konyNetworkProvider(); + var serviceObj = rec; + konyRef.rec = rec; + var mainRef = konyRef.mainRef; + var user_attributes={}; + var isLoggedin = false; + if (serviceObj === undefined || serviceObj.prov == undefined || serviceObj.type == undefined) { + throw new Exception(Errors.INIT_FAILURE, "Invalid service url and service type"); + } + + var _type = serviceObj.type; + var _serviceUrl = stripTrailingCharacter(serviceObj.url, "/");; + var _providerName = serviceObj.prov; + + logger.log("### AuthService:: initialized for provider " + _providerName + " with type " + _type); + + var dsKey = _serviceUrl + "::" + _providerName + "::" + _type + "::RAW"; + + function resetAllCurrentTokens(konyRef, _providerName) { + kony.sdk.resetCacheKeys(konyRef, _providerName); + } + + /** + * Login success callback method. + * @callback loginSuccessCallback + * @param {string} claimsToken - Claims token value + */ + + /** + * Login failure callback method. + * @callback loginFailureCallback + * @param {json} error - Error information + */ + /** + * Login with the given credentials asynchronously and executes the given callback. + * @param {object} options - User name and password + * @param {loginSuccessCallback} successCallback - Callback method on success + * @param {loginFailureCallback} failureCallback - Callback method on failure + */ + this.login = function(options, successCallback, failureCallback) { + + konyRef.isAnonymousProvider = false; + logger.log("### AuthService::login Invoked login for provider " + _providerName + " of type " + _type); + if (typeof(options) == 'undefined') { + throw new Exception(Errors.AUTH_FAILURE, "Missing required number of arguments to login function"); + } + if(options && options["loginOptions"]) + kony.sdk.offline.isOfflineEnabled = options["loginOptions"]["isOfflineEnabled"] || false; + else + kony.sdk.offline.isOfflineEnabled = false; + + function invokeAjaxCall(url, params, headers) { + + if (!headers) { + headers = {}; + } + headers["X-Kony-App-Key"] = mainRef.appKey; + headers["X-Kony-App-Secret"] = mainRef.appSecret; + headers["X-Kony-SDK-Type"] = kony.sdk.getSdkType(); + headers["X-Kony-SDK-Version"] = kony.sdk.version; + headers["X-Kony-Platform-Type"] = kony.sdk.getPlatformName(); + headers["Accept"] = "application/json"; + + var endPointUrl = null; + if (_type === "anonymous") { + endPointUrl = _serviceUrl + url; + } else { + endPointUrl = _serviceUrl + url + "?provider=" + _providerName; + params["provider"] = _providerName; + } + //Save the user entered form data to a temporary store and only if login is successful, we store the value in this to proper credentials store. + if (kony.sdk.getSdkType() === "js" && (_type === "basic" || (options && options["userid"] && options["password"])) && kony.sdk.offline.isOfflineEnabled === true ) { + kony.sdk.offline.saveTempUserCredentials(options, true); + + if(!kony.sdk.isNetworkAvailable()){ + kony.sdk.offline.loginOffline(function(data1){ + logger.log("successfully authenticated offline"); + processLoginSuccessResponse(data1,konyRef,true,successCallback); + },function(error){ + logger.log("offline authentication also failed"); + resetAllCurrentTokens(konyRef, _providerName); + if(failureCallback){ + failureCallback(kony.sdk.error.getAuthErrObj(error)); + } + }); + return; + } + } + networkProvider.post(endPointUrl, params, headers, + function(data) { + processLoginSuccessResponse(data,konyRef,true,successCallback) + }, + function(data) { + processLoginErrorResponse(data,konyRef,true,failureCallback) + }); + } + + if (_type === "anonymous") { + konyRef.isAnonymousProvider = true; + logger.log("### AuthService::login Adapter type is anonymous "); + invokeAjaxCall("/login", {}, { + "Content-Type": "application/x-www-form-urlencoded" + }); + } else if (_type == "basic") { + var mandatory_fields = ["userid", "password"]; + if (serviceObj.mandatory_fields && kony.sdk.isArray(serviceObj.mandatory_fields)) { + mandatory_fields = serviceObj.mandatory_fields; + } + for (var i = 0; i < mandatory_fields.length; ++i) { + if (kony.sdk.isNullOrUndefined(options[mandatory_fields[i]])) { + throw new Exception(Errors.AUTH_FAILURE, " Require " + mandatory_fields[i]); + } + } + var payload = {}; + var encryptedStorage = {}; + for (var option in options) { + payload[option] = options[option]; + } + payload["provider"] = _providerName; + + logger.log("### AuthService::login Adapter type is basic "); + invokeAjaxCall("/login", payload, { + "Content-Type": "application/x-www-form-urlencoded" + }); + } else { + if (options.userid && options.password) { + var payload = {}; + for(var option in options){ + payload[option] = options[option]; + } + payload["provider"] = _providerName; + invokeAjaxCall("/login",payload); + } else { + logger.log("### AuthService::login Adapter type is " + _type); + OAuthHandler(_serviceUrl, _providerName, invokeAjaxCall, _type); + } + } + }; + + + var processLoginSuccessResponse = function(data,konyRef,isAsync,callBack){ + data = kony.sdk.formatSuccessResponse(data); + logger.log("### AuthService::login successful. Retrieved Data:: "); + konyRef.tokens[_providerName] = data; + logger.log("### AuthService::login extracted token. Calling success callback"); + konyRef.currentClaimToken = data.claims_token.value; + konyRef.currentBackEndToken = data.provider_token; + konyRef.claimTokenExpiry = data.claims_token.exp; + konyRef.currentRefreshToken = data.refresh_token; + + if (_type !== "anonymous") { + isLoggedin = true; + } + + if (data.profile && data.profile!=undefined && data.profile.user_attributes!=undefined) { + user_attributes = data.profile.user_attributes; + } + if (!konyRef.getUserId() && data.profile) { + konyRef.setCurrentUserId(data.profile.userid); + } + logger.log("userid is " + konyRef.getUserId()); + + //We store the user credentials and the success auth response only on successful online login. + if (_type === "basic"){ + if(kony.sdk.getSdkType() === "js" && kony.sdk.offline.isOfflineEnabled === true && kony.sdk.isNetworkAvailable()) { + kony.sdk.offline.updateSuccessUserCredentials(); + kony.sdk.offline.saveUserAuthInformation(data); + } + else if(kony.sdk.getSdkType() === "js" && kony.sdk.offline.isOfflineEnabled === false){ + kony.sdk.offline.removeUserCredentials(); + kony.sdk.offline.removeUserAuthInformation(); + } + } + + if(!isAsync){ + return {}; + } + else if(callBack){ + kony.sdk.verifyAndCallClosure(callBack, {}); + } + } + + var processLoginErrorResponse = function(data,konyRef,isAsync,callBack){ + logger.log("### AuthService::login login failure. retrieved data:: "); + logger.log(data); + logger.log("### AuthService::login Calling failure callback"); + + /*resetting all the token in case of error */ + resetAllCurrentTokens(konyRef, _providerName); + if(!isAsync){ + return kony.sdk.error.getAuthErrObj(data); + } + else if(callBack){ + callBack(kony.sdk.error.getAuthErrObj(data)); + } + + } + + + /** + * Login anonymous with the given credentials synchronously and executes the given callback. + * @param {object} options - User name and password + */ + this.anonymousLoginSync = function(options) { + + konyRef.isAnonymousProvider = false; + logger.log("### AuthService::login Invoked login for provider " + _providerName + " of type " + _type); + if (typeof(options) == 'undefined') { + throw new Exception(Errors.AUTH_FAILURE, "Missing required number of arguments to login function"); + } + + function invokeAjaxCall(url, params, headers) { + + if (!headers) { + headers = {}; + } + headers["X-Kony-App-Key"] = mainRef.appKey; + headers["X-Kony-App-Secret"] = mainRef.appSecret; + headers["Accept"] = "application/json"; + + var endPointUrl = null; + if (_type === "anonymous") { + endPointUrl = _serviceUrl + url; + } else { + endPointUrl = _serviceUrl + url + "?provider=" + _providerName; + params["provider"] = _providerName; + } + + var data = networkProvider.postSync(endPointUrl, params, headers); + if(data.opstatus == 0){ + return processLoginSuccessResponse(data,konyRef,false); + } + else{ + return processLoginErrorResponse(data,konyRef,false); + } + } + konyRef.isAnonymousProvider = true; + logger.log("### AuthService::login Adapter type is anonymous "); + return invokeAjaxCall("/login", {}, { + "Content-Type": "application/x-www-form-urlencoded" + }); + }; + /** + * Logout success callback method. + * @callback logoutSuccessCallback + */ + + /** + * Logout failure callback method. + * @callback logoutFailureCallback + */ + /** + * Logout and executes the given callback. + * @param {logoutSuccessCallback} successCallback - Callback method on success + * @param {logoutFailureCallback} failureCallback - Callback method on failure + */ + this.logout = function(successCallback, failureCallback) { + function logoutHandler() { + _logout(successCallback, failureCallback); + } + kony.sdk.claimsRefresh(logoutHandler, failureCallback); + }; + + function _logout(successCallback, failureCallback) { + logger.log("### AuthService::logout invoked on provider " + _providerName + " of type " + _type); + var claimsTokenValue = null; + if (konyRef.tokens[_providerName]) { + claimsTokenValue = konyRef.tokens[_providerName]["claims_token"]["value"]; + delete konyRef.tokens[_providerName]; + } + + networkProvider.post(_serviceUrl + "/logout", {}, { + "Authorization": claimsTokenValue, + "Accept" : "*/*" + }, + function(data) { + logger.log("AuthService::logout successfully logged out. Calling success callback"); + isLoggedin = false; + resetAllCurrentTokens(konyRef, _providerName); + kony.sdk.verifyAndCallClosure(successCallback, {}); + }, + function(err) { + logger.log("### AuthService::logout logged out Failed. Calling failure callback"); + kony.sdk.verifyAndCallClosure(failureCallback,kony.sdk.error.getAuthErrObj(err)); + }); + }; + /** + * Fetch backend token callback method. + * @callback fetchBackendTokenSuccessCallback + * @param {string} providerToken - Provider token value + */ + + /** + * Fetch backend token callback method. + * @callback fetchBackendTokenFailureCallback + * @param {json} error - Error information + */ + /** + * Fetch the backend datasource token. + * @param {boolean} fromserver - Flag to force fetch from server only. + * @param {object} options - Options + * @param {fetchBackendTokenSuccessCallback} successCallback - Callback method on success + * @param {fetchBackendTokenFailureCallback} failureCallback - Callback method on failure + */ + this.getBackendToken = function(fromserver, options, successCallback, failureCallback) { + logger.log("### AuthService::getBackendToken called for provider " + _providerName + " of type " + _type); + if (fromserver != undefined && fromserver === true) { + logger.log("### AuthService::getBackendToken fromserver is enabled. Trying to login"); + _claimsRefresh(null, + function(token) { + konyRef.tokens[_providerName] = token; + konyRef.currentBackEndToken = token.provider_token; + kony.sdk.verifyAndCallClosure(successCallback, token.provider_token); + }, + failureCallback); + } else { + if (konyRef.tokens[_providerName]) { + var val = konyRef.tokens[_providerName]; + var _exp = val.provider_token.exp; + logger.log("token expiry time: " + _exp); + logger.log("Current time: " + (new Date().getTime())); + if (_exp && _exp < (new Date().getTime())) { + logger.log("### AuthService::getBackendToken Token expired. Fetching refresh from claims api"); + _claimsRefresh(null, + function(token) { + konyRef.tokens[_providerName] = token.claims_token.value; + logger.log("### AuthService::getBackendToken fetching refresh successfull. Calling success callback"); + konyRef.currentBackEndToken = token.provider_token; + kony.sdk.verifyAndCallClosure(successCallback, token.provider_token); + }, + function(error) { + logger.log("### AuthService::getBackendToken fetching refresh failed. Calling failure callback"); + konyRef.tokens[_providerName] = null; + konyRef.currentBackEndToken = null; + kony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getAuthErrObj(error)); + }); + } else { + logger.log("### AuthService::getBackendToken present token is valid/doesn't have expiry time. Calling success callback"); + konyRef.currentBackEndToken = val.provider_token; + kony.sdk.verifyAndCallClosure(successCallback, val.provider_token); + } + } else { + logger.log("### AuthService::getBackendToken failed for find info for key " + dsKey + "in database. calling failure callback"); + kony.sdk.verifyAndCallClosure(failureCallback, null); + } + } + }; + /** + * Get profile callback method. + * @callback getProfileSuccessCallback + * @param {object} profile - Profile object + */ + + /** + * Get profile callback method. + * @callback getProfileFailureCallback + */ + /** + * Get profile. + * @param {boolean} fromserver - Flag to force fetch from server only. + * @param {getProfileSuccessCallback} successCallback - Callback method on success + * @param {getProfileFailureCallback} failureCallback - Callback method on failure + */ + this.getProfile = function(fromserver, successCallback, failureCallback) { + if (fromserver && fromserver == true) { + _claimsRefresh(null, + function(token) { + konyRef.tokens[_providerName] = token; + kony.sdk.verifyAndCallClosure(successCallback, token.profile); + }, + failureCallback) + } else { + if (konyRef.tokens[_providerName]) { + var val = konyRef.tokens[_providerName] + kony.sdk.verifyAndCallClosure(successCallback, val.profile); + } else { + kony.sdk.verifyAndCallClosure(failureCallback, null); + } + } + }; + /** + * Get the provider name. + * @returns {string} Provider name. + */ + this.getProviderName = function() { + return _providerName; + }; + /** + * Get the provider type. + * @returns {string} Provider type. + */ + this.getProviderType = function() { + return _type; + }; + + /** + * Get the generic session data type. + * @returns {string} session data. + */ + this.getUserData = function(successCallback, failureCallback) { + var userDataUrl = _serviceUrl + "/session/user_data"; + getSessionData(userDataUrl, successCallback, failureCallback); + }; + + /** + * Get the user attributes returned by a provider + * @returns {string} user attributes. + */ + this.getUserAttributes = function(successCallback, failureCallback) { + if(isLoggedin == false){ + kony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getNullClaimsTokenErrObj()); + } + else if(user_attributes && Object.keys(user_attributes).length === 0){ + var userAttributesUrl = _serviceUrl + "/session/user_attributes?provider=" + _providerName; + getSessionData(userAttributesUrl, function(res){ + user_attributes = res; + kony.sdk.verifyAndCallClosure(successCallback,user_attributes); + }, failureCallback); + }else{ + if (konyRef.currentClaimToken === null) { + kony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getNullClaimsTokenErrObj()); + }else{ + kony.sdk.verifyAndCallClosure(successCallback,user_attributes ); + } + } + }; + + /** + * Get the security attributes returned by a provider + * @returns {string} security attributes. + */ + this.getSecurityAttributes = function(successCallback, failureCallback) { + var securityAttributesUrl = _serviceUrl + "/session/security_attributes?provider=" + _providerName; + getSessionData(securityAttributesUrl, successCallback, failureCallback); + }; + + /** + utility method to get session data + @private + */ + var getSessionData = function(sessionAttributesEndPointUrl, successCallback, failureCallback) { + if (konyRef.currentClaimToken === null) { + kony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getNullClaimsTokenErrObj()); + } + else{ + networkProvider.post(sessionAttributesEndPointUrl, {}, { + "Authorization": konyRef.currentClaimToken, + "X-HTTP-Method-Override": "GET" + }, + function(data) { + data = kony.sdk.formatSuccessResponse(data); + kony.sdk.verifyAndCallClosure(successCallback, data); + }, + function(err) { + kony.sdk.verifyAndCallClosure(failureCallback, kony.sdk.error.getAuthErrObj(err)); + }); + } + }; + + + + /** + * Method to refresh the claims token. + * @private + */ + var _claimsRefresh = function(options, success, failure) { + logger.log("### AuthService::_claimsRefresh fetching claims from server for provider " + _providerName); + var value = konyRef.tokens[_providerName]; + var refreshToken = null; + if (value) { + refreshToken = value.refresh_token; + } + if(kony.sdk.getSdkType() === "js" && kony.sdk.offline.isOfflineEnabled && kony.sdk.offline.isOfflineEnabled == true && !kony.sdk.isNetworkAvailable()){ + return kony.sdk.offline.getClaimsToken(); + } + var _url = _serviceUrl + "/claims"; + if (options && options.requestParams != null) { + _url = _url + "?" + for (var i in options.requestParams) { + if (options.requestParams.hasOwnProperty(i) && typeof(i) !== 'function') { + _url = _url + (i + "=" + options.requestParams[i] + "&"); + } + } + _url = stripTrailingCharacter(_url, "&"); + } + if (refreshToken) { + logger.log("### AuthService::_claimsRefresh making POST request to claims endpoint"); + networkProvider.post(_url, {}, { + "Authorization": refreshToken, + "Content-Type": "application/x-www-form-urlencoded" + }, + function(data) { + data = kony.sdk.formatSuccessResponse(data); + logger.log("### AuthService::_claimsRefresh Fetching claims succcessfull"); + konyRef.tokens[_providerName] = data; + logger.log("### AuthService::_claimsRefresh saved locally. Calling success callback"); + kony.sdk.verifyAndCallClosure(success, data); + }, + function(xhr, status, err) { + logger.log("### AuthService::_claimsRefresh fetching claims failed. Calling failure callback"); + kony.sdk.verifyAndCallClosure(failure, kony.sdk.error.getAuthErrObj(err)); + }); + } else { + logger.log("### AuthService::_claimsRefresh no refreshtoken found. calling failure callback"); + kony.sdk.verifyAndCallClosure(failure, kony.sdk.error.getNullRefreshTokenErrObj()); + } + }; +}; + +stripTrailingCharacter = function(str, character) { + if (str.substr(str.length - 1) == character) { + return str.substr(0, str.length - 1); + } + return str; +}; + +var Constants = { + APP_KEY_HEADER: "X-Kony-App-Key", + APP_SECRET_HEADER: "X-Kony-App-Secret", + AUTHORIZATION_HEADER: "Authorization" +}; + +var Errors = { + INIT_FAILURE: "INIT_FAILURE", + DATA_STORE_EXCEPTION: "DATASTORE_FAILURE", + AUTH_FAILURE: "AUTH_FAILURE", + INTEGRATION_FAILURE: "INTEGRATION_FAILURE", + MESSAGING_FAILURE: "MESSAGING_FAILURE", + SYNC_FAILURE: "SYNC_FAILURE", + METRICS_FAILURE: "METRICS_FAILURE", + MISC_FAILURE: "MISCELLANEOUS_FAILURE", + OBJECT_FAILURE: "OBJECT_FAILURE" +}; +kony.sdk.prototype.enableDebug = function() { + kony.sdk.isDebugEnabled = true; +} + +kony.sdk.prototype.disableDebug = function() { + kony.sdk.isDebugEnabled = false; +} + +function Exception(name, message) { + alert(name + ": " + message); + return { + code: name, + message: message + }; +}; + +kony.sdk.verifyAndCallClosure = function(closure, params) { + if (typeof(closure) === 'function') { + closure(params); + } else { + var logger = new konyLogger(); + logger.log("invalid callback"); + } +} + +kony.sdk.formatCurrentDate = function(inputDateString) { + var dateObj = new Date(inputDateString); + var year = dateObj.getUTCFullYear(); + var month = kony.sdk.formatDateComponent(dateObj.getUTCMonth() + 1); + var date = kony.sdk.formatDateComponent(dateObj.getUTCDate()); + var hours = kony.sdk.formatDateComponent(dateObj.getUTCHours()); + var minutes = kony.sdk.formatDateComponent(dateObj.getUTCMinutes()); + var seconds = kony.sdk.formatDateComponent(dateObj.getUTCSeconds()); + var dateSeparator = "-" + var timeSeparator = ":" + var dateString = year + dateSeparator + month + dateSeparator + date + " " + hours + timeSeparator + minutes + timeSeparator + seconds; + return dateString; +} + +kony.sdk.formatDateComponent = function(dateComponent) { + if (dateComponent < 10) { + dateComponent = "0" + dateComponent; + } + return dateComponent; +} + +kony.sdk.isNullOrUndefined = function(val) { + if (val === null || val === undefined) { + return true; + } else { + return false; + } +}; + +kony.sdk.constants = { + reportingType: { + session: "session", + custom: "custom" + } +}; + +kony.sdk.isEmptyObject = function(obj) { + for (var prop in obj) { + return false; + } + return true; +}; + + +kony.sdk.isArray = function(data) { + if (data && Object.prototype.toString.call(data) === '[object Array]') { + return true; + } + return false; +} + + +kony.sdk.formatSuccessResponse = function(data) +{ + if(data && data.httpresponse) + { + delete data.httpresponse; + } + return data; +} + +kony.sdk.isJson = function(str) { + try { + JSON.parse(str); + } catch (e) { + return false; + } + return true; +} + +//private method to identify whether session/token expired or not based on error code +kony.sdk.isSessionOrTokenExpired = function(mfcode) { + if (mfcode && (mfcode === "Auth-5" || mfcode === "Auth-6" || mfcode === "Gateway-31" || mfcode === "Gateway-33" || mfcode === "Gateway-35" || mfcode === "Gateway-36" || mfcode === "Auth-46" || mfcode === "Auth-55")) { + return true; + } + return false; +} + +//private method to clear cache +kony.sdk.resetCacheKeys = function(konyRef, _providerName) { + try { + if (konyRef) { + konyRef.currentClaimToken = null; + konyRef.currentBackEndToken = null; + konyRef.claimTokenExpiry = null; + konyRef.currentRefreshToken = null; + //setting the anonymous provider as true to access the public protected urls without any issue + konyRef.isAnonymousProvider = true; + if (_providerName) { + if (konyRef.tokens.hasOwnProperty(_providerName)) { + konyRef.tokens[_providerName] = null; + } + } + } + } catch(e) { + var logger = new konyLogger(); + logger.log("Error while clearing the cache.."); + } +} +kony.sdk.serviceDoc = function() { + var appId = ""; + var baseId = ""; + var name = ""; + var selflink = ""; + var login = null; + var integsvc = {}; + var reportingsvc = {}; + var messagingsvc = {}; + var sync = {}; + var objectsvc = {}; + + this.toJSON = function() { + servConfig = {}; + servConfig.appId = this.getAppId(); + servConfig.baseId = this.getBaseId(); + servConfig.name = this.getAppName(); + servConfig.selflink = this.getSelfLink(); + servConfig.login = this.getAuthServices(); + servConfig.integsvc = this.getIntegrationServices(); + servConfig.messagingsvc = this.getMessagingServices(); + servConfig.sync = this.getSyncServices(); + servConfig.reportingsvc = this.getReportingServices(); + servConfig.objectsvc = this.getObjectServices(); + return servConfig; + } + + this.setAppId = function(appIdStr) { + appId = appIdStr; + }; + + this.getAppId = function() { + return appId; + }; + + this.setBaseId = function(baseIdStr) { + baseId = baseIdStr; + }; + + this.getBaseId = function() { + return baseId; + }; + + this.setAppName = function(appName) { + name = appName; + }; + + this.getAppName = function() { + return name; + }; + + this.setSelfLink = function(selfLinkStr) { + selflink = selfLinkStr; + }; + + this.getSelfLink = function() { + return selflink; + }; + + function setEndPoints(providerType, providerValues) { + for (var provider in providerValues) { + providerType[provider] = providerValues[provider]; + } + } + + this.setAuthService = function(loginProvider) { + if(login === null){ + login = []; + } + login.push(loginProvider); + }; + + //what will this return? name? + this.getAuthServiceByName = function(authServiceProvider) { + if(login === null){ + return null; + } + for (var i in login) { + var provider = login[i]; + if (provider.prov == authServiceProvider) { + return provider; + } + } + }; + + this.getAuthServices = function() { + return login; + }; + + this.setIntegrationService = function(providerName, endPointUrl) { + integsvc[providerName] = endPointUrl; + }; + + this.getIntegrationServiceByName = function(integrationServiceProviderName) { + return integsvc[integrationServiceProviderName]; + }; + + this.getIntegrationServices = function() { + return integsvc; + }; + + this.setObjectService = function(providerName, endPointUrl) { + objectsvc[providerName] = endPointUrl; + }; + + this.getObjectServiceByName = function(objectServiceProviderName) { + return objectsvc[objectServiceProviderName]; + }; + + this.getObjectServices = function() { + return objectsvc; + }; + + this.setReportingService = function(reportingType, url) { + if (reportingType == kony.sdk.constants.reportingType.session || reportingType == kony.sdk.constants.reportingType.custom) { + reportingsvc[reportingType] = url; + } else { + throw new Exception(Errors.INIT_FAILURE, "invalid reporting type " + reportingType); + } + } + + this.getReportingServiceByType = function(reportingServiceProviderType) { + return reportingsvc[reportingServiceProviderType]; + }; + + this.getReportingServices = function() { + return reportingsvc; + }; + + this.setMessagingService = function(appId, url) { + messagingsvc[appId] = url; + }; + + this.getMessagingServiceByName = function(messagingServiceProviderName) { + return messagingsvc[messagingServiceProviderName]; + }; + + this.getMessagingServices = function() { + return messagingsvc; + } + + this.setSyncService = function(syncServiceProvider) { + sync = syncServiceProvider; + }; + + this.getSyncServices = function() { + return sync; + }; + +}; + +if (typeof(kony.sdk.metric) === "undefined") { + kony.sdk.metric = {}; +} + +kony.sdk.metric.eventFlowTag = ""; +kony.sdk.metric.eventConfig = { + "confType": "BUFFER", + "eventBufferAutoFlushCount": kony.sdk.metric.eventBufferAutoFlushValue, + "eventBufferMaxCount": kony.sdk.metric.eventBufferMaxValue +}; +kony.sdk.metric.eventBufferMaxValue = 1000; +kony.sdk.metric.eventBufferAutoFlushValue = 15; +kony.sdk.metric.characterLengthLimit = 256; +kony.sdk.metric.reportEventBufferArray = []; +kony.sdk.metric.reportEventBufferBackupArray = []; +kony.sdk.metric.retrievedDS = false; +kony.sdk.metric.eventBufferCount = 0; +kony.sdk.metric.eventTypeMap = { + "formentry": "FormEntry", + "touch": "Touch", + "servicecall": "ServiceCall", + "gesture": "Gesture", + "orientation": "Orientation", + "custom": "Custom" +}; +kony.sdk.metric.errorCodeMap = { + "1000": true, + "1011": true, + "1012": true, + "1014": true, + "1015": true, + "1016": true +}; + +kony.sdk.metric.setEventFlowTag = function(flowTag) { + if (kony.sdk.isNullOrUndefined(flowTag)) { + throw new Exception(Errors.METRICS_FAILURE, "Invalid value for event flow tag"); + } else if (flowTag.length <= kony.sdk.metric.characterLengthLimit) { + kony.sdk.metric.eventFlowTag = flowTag; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + kony.sdk.metric.characterLengthLimit + " characters"); + } +}; + +kony.sdk.metric.clearEventFlowTag = function() { + kony.sdk.metric.eventFlowTag = ""; +}; + +kony.sdk.metric.getEventFlowTag = function() { + return kony.sdk.metric.eventFlowTag; +}; + +kony.sdk.metric.setEventConfig = function(confType, eventBufferAutoFlushCount, eventBufferMaxCount) { + if (kony.sdk.isNullOrUndefined(confType)) { + throw new Exception(Errors.METRICS_FAILURE, "Config Type can not be null"); + } else { + confType = confType.toUpperCase(); + } + if (confType === "BUFFER") { + kony.sdk.metric.eventConfig["confType"] = confType; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Invalid value for config type"); + } + if (!kony.sdk.isNullOrUndefined(eventBufferMaxCount) && typeof(eventBufferMaxCount) === "number" && eventBufferMaxCount > 0) { + kony.sdk.metric.eventConfig["eventBufferMaxCount"] = eventBufferMaxCount; + } else { + throw new Exception(Errors.METRICS_FAILURE, "eventBufferMaxCount has to be a Number and greater than 0"); + } + if (!kony.sdk.isNullOrUndefined(eventBufferAutoFlushCount) && typeof(eventBufferAutoFlushCount) === "number" && eventBufferAutoFlushCount > 0 && eventBufferAutoFlushCount <= eventBufferMaxCount) { + kony.sdk.metric.eventConfig["eventBufferAutoFlushCount"] = eventBufferAutoFlushCount; + } else if (eventBufferAutoFlushCount >= eventBufferMaxCount) { + kony.sdk.metric.eventConfig["eventBufferMaxCount"] = 1000; + throw new Exception(Errors.METRICS_FAILURE, "eventBufferAutoFlushCount can not be greater than eventBufferMaxCount"); + } else { + throw new Exception(Errors.METRICS_FAILURE, "eventBufferAutoFlushCount has to be a Number and greater than 0"); + } +}; + +kony.sdk.metric.reportEvent = function(evttype, evtSubType, formID, widgetID, flowTag) { + if (kony.sdk.metric.reportEventBufferBackupArray.length === 0) { + kony.sdk.metric.readFromDS(); + } + kony.sdk.metric.eventBufferCount = kony.sdk.metric.reportEventBufferBackupArray.length + kony.sdk.metric.reportEventBufferArray.length; + + if (kony.sdk.metric.eventBufferCount === kony.sdk.metric.eventConfig["eventBufferMaxCount"]) { + throw new Exception(Errors.DATA_STORE_EXCEPTION, "Reached maximum limit to store events"); + return; + } + var reportEventMap = {}; + reportEventMap.ts = kony.sdk.formatCurrentDate(new Date()); + evttype = evttype.toLowerCase(); + if (kony.sdk.isNullOrUndefined(kony.sdk.metric.eventTypeMap[evttype])) { + throw new Exception(Errors.METRICS_FAILURE, "Invalid value for event type"); + return; + } else { + reportEventMap["evttype"] = kony.sdk.metric.eventTypeMap[evttype]; + } + if (kony.sdk.isNullOrUndefined(evtSubType)) { + reportEventMap["evtSubType"] = ""; + } else if (evtSubType.length <= kony.sdk.metric.characterLengthLimit) { + reportEventMap["evtSubType"] = evtSubType; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + kony.sdk.metric.characterLengthLimit + " characters"); + return; + } + if (kony.sdk.isNullOrUndefined(formID)) { + reportEventMap["formID"] = kony.application.getCurrentForm().id; + } else if (formID.length <= kony.sdk.metric.characterLengthLimit) { + reportEventMap["formID"] = formID; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + kony.sdk.metric.characterLengthLimit + " characters"); + return; + } + if (kony.sdk.isNullOrUndefined(widgetID)) { + reportEventMap["widgetID"] = ""; + } else if (widgetID.length <= kony.sdk.metric.characterLengthLimit) { + reportEventMap["widgetID"] = widgetID; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + kony.sdk.metric.characterLengthLimit + " characters"); + return; + } + if (kony.sdk.isNullOrUndefined(flowTag)) { + reportEventMap["flowTag"] = kony.sdk.metric.getEventFlowTag(); + } else if (flowTag.length <= kony.sdk.metric.characterLengthLimit) { + reportEventMap["flowTag"] = flowTag; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + kony.sdk.metric.characterLengthLimit + " characters"); + return; + } + reportEventMap.SID = kony.ds.read("konyUUID")[0]; + kony.sdk.metric.reportEventBufferArray.push(reportEventMap); + + if (kony.sdk.metric.reportEventBufferArray.length % kony.sdk.metric.eventConfig["eventBufferAutoFlushCount"] === 0) { + kony.sdk.metric.flushEvents(); + } +}; + +kony.sdk.metric.flushEvents = function() { + var logger = new konyLogger(); + if (kony.sdk.metric.reportEventBufferBackupArray.length === 0) { + kony.sdk.metric.readFromDS(); + } + if (kony.sdk.metric.reportEventBufferBackupArray.length === 0 && kony.sdk.metric.reportEventBufferArray.length === 0) { + logger.log("There are no events to flush"); + return; + } + var payload = kony.sdk.getPayload(kony.sdk.getCurrentInstance()); + var params = {}; + if (kony.sdk.metric.reportEventBufferArray.length !== 0) { + kony.sdk.metric.pushEventsToBufferArray(); + } + var headers = { + "Content-Type": "application/x-www-form-urlencoded" + }; + params.httpheaders = headers; + payload.events = kony.sdk.metric.reportEventBufferBackupArray; + payload.svcid = "SendEvents"; + payload.rsid = kony.sdk.metric.reportEventBufferBackupArray[0].SID; + params.konyreportingparams = JSON.stringify(payload); + kony.net.invokeServiceAsync(kony.sdk.currentInstance.customReportingURL, params, flushCallback); + + function flushCallback(status, response) { + if (status === 400) { + if (response.opstatus === 0) { + kony.sdk.metric.clearBufferEvents(); + } else if (kony.sdk.metric.errorCodeMap[response.opstatus]) { + kony.sdk.metric.saveInDS(); + } else { + kony.sdk.metric.clearBufferEvents(); + } + } else if (status === 300) { + kony.sdk.metric.saveInDS(); + } + } +}; + +/*Stores event data in Data Store on failure of service Call*/ +kony.sdk.metric.saveInDS = function() { + var eventsToSave = []; + eventsToSave.push(JSON.stringify(kony.sdk.metric.reportEventBufferBackupArray)); + kony.ds.save(eventsToSave, "konyMetricsBuffer"); + kony.sdk.metric.reportEventBufferBackupArray = []; +}; + +/*Clearing events sent to server */ +kony.sdk.metric.clearBufferEvents = function() { + kony.sdk.metric.reportEventBufferBackupArray = []; + kony.ds.remove("konyMetricsBuffer"); +}; + +/*Reading any pending events from Data Store */ +kony.sdk.metric.readFromDS = function() { + var eventsFromDS = kony.ds.read("konyMetricsBuffer"); + if (eventsFromDS !== null) { + var pushToArray = []; + pushToArray.push(JSON.parse(eventsFromDS[0])); + kony.sdk.metric.reportEventBufferBackupArray.push.apply(kony.sdk.metric.reportEventBufferBackupArray, pushToArray); + } +}; + +/*Pushes events received from user to BufferBackupArray which will be flushed to server */ +kony.sdk.metric.pushEventsToBufferArray = function() { + kony.sdk.metric.reportEventBufferBackupArray.push.apply(kony.sdk.metric.reportEventBufferBackupArray, kony.sdk.metric.reportEventBufferArray); + kony.sdk.metric.reportEventBufferArray = []; +}; + +kony.sdk.metric.getEventsInBuffer = function() { + var eventsFromDS = kony.ds.read("konyMetricsBuffer"); + var eventsToReturn = []; + if (!kony.sdk.isNullOrUndefined(eventsFromDS)) { + eventsToReturn.push(JSON.parse(eventsFromDS[0])); + } + if (kony.sdk.metric.reportEventBufferArray.length !== 0) { + eventsToReturn.push.apply(eventsToReturn, kony.sdk.metric.reportEventBufferArray); + } + if (eventsToReturn.length !== 0) { + return eventsToReturn; + } else { + return null; + } +}; +/** + * Method to create the integration service instance with the provided service name. + * @param {string} serviceName - Name of the service + * @returns {IntegrationService} Integration service instance + */ +kony.sdk.prototype.getIntegrationService = function(serviceName) { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + var konyRef = kony.sdk.getCurrentInstance(); + if (!this.currentClaimToken && !konyRef.isAnonymousProvider) { + throw new Exception(Errors.AUTH_FAILURE, "Please call login in Identity Service before invoking this service"); + } + var logger = new konyLogger(); + var integrationService = null; + if (this.integsvc != null) { + if (this.integsvc[serviceName] != null) { + logger.log("found integration service" + this.integsvc[serviceName]); + return new IntegrationService(this, serviceName); + } + + } + + throw new Exception(Errors.INTEGRATION_FAILURE, "Invalid serviceName"); + +}; +/** + * Should not be called by the developer. + * @class + * @classdesc Integration service instance for invoking the integration services. + */ +function IntegrationService(konyRef, serviceName) { + var logger = new konyLogger(); + var dataStore = new konyDataStore(); + var homeUrl = konyRef.integsvc[serviceName]; + var networkProvider = new konyNetworkProvider(); + if (homeUrl == undefined || serviceName == undefined) { + throw new Exception(Errors.INIT_FAILURE, "Invalid homeUrl and serviceName"); + } + homeUrl = stripTrailingCharacter(homeUrl, "/"); + + + this.getUrl = function() { + return homeUrl; + }; + /** + * Integration service success callback method. + * @callback integrationSuccessCallback + * @param {json} response - Integration service response + */ + + /** + * Integration service failure callback method. + * @callback integrationFailureCallback + * @param {json} error - Error information + */ + /** + * invoke the specified operation + * @param {string} operationName - Name of the operation + * @param {object} headers - Input headers for the operation + * @param {object} data - Input data for the operation + * @param {integrationSuccessCallback} successCallback - Callback method on success + * @param {integrationFailureCallback} failureCallback - Callback method on failure + */ + this.invokeOperation = function(operationName, headers, data, successCallback, failureCallback) { + function invokeOperationHandler() { + _invokeOperation(operationName, headers, data, successCallback, failureCallback); + } + kony.sdk.claimsRefresh(invokeOperationHandler, failureCallback); + }; + + function _invokeOperation(operationName, headers, data, successCallback, failureCallback) { + var requestData = {}; + var logger = new konyLogger(); + var reportingData = kony.sdk.getPayload(konyRef); + reportingData.rsid = kony.ds.read("konyUUID")[0]; + if(!reportingData.rsid) + { + logger.log("rsid is either empty,null or undefined"); + } + if (kony.sdk.metric) { + if (kony.sdk.metric.reportEventBufferBackupArray.length === 0) { + kony.sdk.metric.readFromDS(); + } + kony.sdk.metric.pushEventsToBufferArray(); + requestData.events = kony.sdk.metric.reportEventBufferBackupArray; + } + for (var key in data) { + requestData[key] = data[key]; + } + reportingData.svcid = operationName; + var token; + for (var i in konyRef.tokens) { + if (konyRef.tokens.hasOwnProperty(i) && typeof(i) !== 'function') { + token = konyRef.tokens[i]; + break; + } + } + + requestData["konyreportingparams"] = JSON.stringify(reportingData); + var defaultHeaders = { + "Content-Type": "application/x-www-form-urlencoded", + "X-Kony-Authorization": konyRef.currentClaimToken + } + + // if the user has defined his own headers, use them + if (headers) { + for (var header in headers) { + defaultHeaders[header] = headers[header]; + } + } + + networkProvider.post(homeUrl + "/" + operationName, + requestData, defaultHeaders, + function(res) { + if (kony.sdk.metric) { + kony.sdk.metric.clearBufferEvents(); + } + kony.sdk.verifyAndCallClosure(successCallback, res); + }, + function(xhr, status, err) { + kony.sdk.processIntegrationErrorResponse(xhr,true,failureCallback); + }); + }; + + kony.sdk.processIntegrationErrorResponse = function(err,isAsync,callBack){ + if (kony.sdk.metric) { + if (kony.sdk.metric.errorCodeMap[err.opstatus]) { + kony.sdk.metric.saveInDS(); + } + } + if(err["mfcode"]){ + var konyRef = kony.sdk.getCurrentInstance(); + //clear the cache if the error code related to session/token expiry + if (kony.sdk.isSessionOrTokenExpired(err["mfcode"])) { + kony.sdk.resetCacheKeys(konyRef); + } + } + if(!isAsync){ + return kony.sdk.error.getIntegrationErrObj(err); + } + else if(callBack){ + kony.sdk.verifyAndCallClosure(callBack, kony.sdk.error.getIntegrationErrObj(err)); + } + } + /** + * invoke the specified operation + * @param {string} operationName - Name of the operation + * @param {object} headers - Input headers for the operation + * @param {object} data - Input data for the operation + */ + this.invokeOperationSync = function(operationName, headers, data) { + var res=null; + res = kony.sdk.claimsRefreshSync(); + if(res && res.message && res.message == "success") + { + return _invokeOperationSync(operationName, headers, data); + } + else{ + return res; + } + }; + + function _invokeOperationSync(operationName, headers, data) { + var requestData = {}; + var logger = new konyLogger(); + var konyRef = kony.sdk.getCurrentInstance(); + var reportingData = kony.sdk.getPayload(konyRef); + reportingData.rsid = kony.ds.read("konyUUID")[0]; + if(!reportingData.rsid) + { + logger.log("rsid is either empty,null or undefined"); + } + if (kony.sdk.metric) { + if (kony.sdk.metric.reportEventBufferBackupArray.length === 0) { + kony.sdk.metric.readFromDS(); + } + kony.sdk.metric.pushEventsToBufferArray(); + requestData.events = kony.sdk.metric.reportEventBufferBackupArray; + } + for (var key in data) { + requestData[key] = data[key]; + } + reportingData.svcid = operationName; + var token; + for (var i in konyRef.tokens) { + if (konyRef.tokens.hasOwnProperty(i) && typeof(i) !== 'function') { + token = konyRef.tokens[i]; + break; + } + } + + requestData["konyreportingparams"] = JSON.stringify(reportingData); + var defaultHeaders = { + "Content-Type": "application/x-www-form-urlencoded", + "X-Kony-Authorization": konyRef.currentClaimToken + } + + // if the user has defined his own headers, use them + if (headers) { + for (var header in headers) { + defaultHeaders[header] = headers[header]; + } + } + var res = null; + res = networkProvider.postSync(homeUrl + "/" + operationName, + requestData, defaultHeaders); + if(res.opstatus == 0){ + if (kony.sdk.metric) { + kony.sdk.metric.clearBufferEvents(); + } + return res; + } + else{ + return kony.sdk.processIntegrationErrorResponse(res,false); + } + }; +}; + +kony.sdk.claimsRefreshSync = function() { + var konyRef = kony.sdk.getCurrentInstance(); + var logger = new konyLogger(); + var networkProvider = new konyNetworkProvider(); + var loginWithAnonymousProvider = function() { + var identityObject = konyRef.getIdentityService("$anonymousProvider"); + var res = identityObject.anonymousLoginSync(null); + if(res && JSON.stringify(res) == "{}") + { + return {"message" : "success"}; + } + else{ + return kony.sdk.error.getAuthErrObj(res); + } + }; + + if (konyRef.currentClaimToken === null) { + logger.log("claims Token is Unavialable"); + if (konyRef.isAnonymousProvider) { + return loginWithAnonymousProvider(); + } else { + return kony.sdk.error.getNullClaimsTokenErrObj(); + } + } else if (konyRef.claimTokenExpiry && new Date().getTime() > konyRef.claimTokenExpiry) { + if (konyRef.isAnonymousProvider) { + return loginWithAnonymousProvider(); + } else { + logger.log("claims token has expired. fetching new token..") + var _serviceUrl = stripTrailingCharacter(konyRef.rec.url, "/"); + var _url = _serviceUrl + "/claims"; + logger.log("service url is " + _url); + if (konyRef.currentRefreshToken === null) { + return kony.sdk.error.getNullRefreshTokenErrObj(); + } else { + var data = networkProvider.postSync(_url, {}, { + "Authorization": konyRef.currentRefreshToken, + "Content-Type": "application/x-www-form-urlencoded" + }); + if(data.opstatus == 0){ + logger.log("refresh success..acquiring new tokens"); + return kony.sdk.processClaimsSuccessResponse(data,konyRef,false); + } + else{ + logger.log("failed to acquire refresh token"); + return kony.sdk.processClaimsErrorResponse(data,konyRef,false); + } + } + } + } else { + return { "message" :"success"}; + } +}; +/** + * Method to create the messaging service instance. + * @returns {MessagingService} Messaging service instance + */ +kony.sdk.prototype.getMessagingService = function() { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + return new MessagingService(this); +} + +/** + * Should not be called by the developer. + * @class + * @classdesc Messaging service instance for invoking the Messaging services. + *@param reference to kony object + */ +function MessagingService(konyRef) { + + var homeUrl = konyRef.messagingsvc.url; + var KSID; + var appId = konyRef.messagingsvc.appId; + var logger = new konyLogger(); + var networkProvider = new konyNetworkProvider(); + var dsKey = homeUrl + ":KMS:AppId"; + + this.getUrl = function() { + return homeUrl; + }; + + this.setKSID = function(ksid) { + konyRef.getDataStore().setItem(dsKey, ksid); + KSID = ksid; + }; + + this.getKSID = function() { + if (!KSID) { + KSID = konyRef.getDataStore().getItem(dsKey); + } + return KSID; + }; + + this.setKmsAppId = function(id) { + appId = id; + }; + + this.getKmsAppId = function() { + return appId; + }; + + var registerForMessagingService = function(osType, deviceId, pnsToken, email, authToken, successCallback, failureCallback) { + var uri = homeUrl + "/subscribers"; + var subscribeParamsJson = { + "sid": pnsToken, + "appId": appId, + "ufid": email, + "osType": osType, + "deviceId": deviceId + } + if(authToken!=undefined && authToken != null) + subscribeParamsJson["authToken"] = authToken; + jsonParam = { + "subscriptionService": { + "subscribe": subscribeParamsJson + } + }; + logger.log(JSON.stringify(jsonParam)); + var headers = { + "Content-Type": "application/json" + }; + var payload = { + postdata: JSON.stringify(jsonParam) + }; + networkProvider.post(uri, + payload, + headers, + function(data) { + KSID = data.id; + konyRef.getDataStore().setItem(dsKey, KSID); + logger.log("Device registered to KMS with KSID:" + KSID); + kony.sdk.verifyAndCallClosure(successCallback, data); + }, + function(data, status, error) { + + logger.log("ERROR: Failed to register device for KMS"); + var errorObj = {}; + errorObj.data = data; + errorObj.status = status; + errorObj.error = error; + kony.sdk.verifyAndCallClosure(failureCallback, errorObj); + }); + } + /** + * register success callback method. + * @callback registerSuccessCallback + * @param {json} response - register response + */ + + /** + * Register service failure callback method. + * @callback registerFailureCallback + * @param {json} error - Error information + */ + /** + * register to messaging service + * @param {string} osType - Type of the operating system + * @param {string} deviceId - Device Id + * @param {string} pnsToken - Token value + * @param {registerSuccessCallback} successCallback - Callback method on success + * @param {registerFailureCallback} failureCallback - Callback method on failure + */ + this.register = function(osType, deviceId, pnsToken, email, successCallback, failureCallback) { + if (typeof(pnsToken) === 'undefined' || pnsToken === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid pnsToken/sId. Please check your messaging provider"); + } + if (typeof(osType) === 'undefined' || osType === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid osType."); + } + if (typeof(deviceId) === 'undefined' || deviceId === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid deviceId."); + } + if (typeof(email) === 'undefined' || email === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid email."); + } + registerForMessagingService(osType, deviceId, pnsToken, email, null,function(data){ + kony.sdk.verifyAndCallClosure(successCallback, data) + }, function(errorObj){ + kony.sdk.verifyAndCallClosure(failureCallback, errorObj); + }); + }; + /** + * register success callback method. + * @callback registerSuccessCallback + * @param {json} response - register response + */ + + /** + * Register service failure callback method. + * @callback registerFailureCallback + * @param {json} error - Error information + */ + /** + * register to messaging service + * @param {string} osType - Type of the operating system + * @param {string} deviceId - Device Id + * @param {string} authToken - Authorization Token + * @param {string} pnsToken - Token value + * @param {registerSuccessCallback} successCallback - Callback method on success + * @param {registerFailureCallback} failureCallback - Callback method on failure + */ + this.registerWithAuthToken = function(osType, deviceId, pnsToken, email, authToken, successCallback, failureCallback) { + if (typeof(pnsToken) === 'undefined' || pnsToken === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid pnsToken/sId. Please check your messaging provider"); + } + if (typeof(osType) === 'undefined' || osType === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid osType."); + } + if (typeof(deviceId) === 'undefined' || deviceId === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid deviceId."); + } + if (typeof(email) === 'undefined' || email === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid email."); + } + if (typeof(authToken) === 'undefined' || authToken === null) { + throw new Exception(Errors.MESSAGING_FAILURE, "Invalid authToken."); + } + registerForMessagingService(osType, deviceId, pnsToken, email, authToken,function(data){ + kony.sdk.verifyAndCallClosure(successCallback, data) + }, function(errorObj){ + kony.sdk.verifyAndCallClosure(failureCallback, errorObj); + }); + }; + /** + * unregister success callback method. + * @callback unregisterSuccessCallback + */ + + /** + * unregister service failure callback method. + * @callback unregisterFailureCallback + */ + /** + * unregister to messaging service + * @param {unregisterSuccessCallback} successCallback - Callback method on success + * @param {unregisterFailureCallback} failureCallback - Callback method on failure + */ + this.unregister = function(successCallback, failureCallback) { + var uri = homeUrl + "/subscribers" + var sub = { + "ksid": this.getKSID() + }; + var inp = { + "subscriptionService": { + "unsubscribe": sub + } + }; + var headers = { + "Content-Type": "application/json" + }; + var payload = { + postdata: JSON.stringify(inp) + } + logger.log("unsubscribe uri:" + uri); + konyRef.getDataStore().removeItem(dsKey); + networkProvider.post(uri, + payload, + headers, + function(data) { + kony.sdk.verifyAndCallClosure(successCallback, data); + }, + function(data, status, error) { + + logger.log("ERROR: Failed to unregister device for KMS"); + var errorObj = {}; + errorObj.data = data; + errorObj.status = status; + errorObj.error = error; + kony.sdk.verifyAndCallClosure(failureCallback, errorObj); + }); + }; + /** + * Fetch all messages success callback method. + * @callback fetchAllMessagesSuccessCallback + * @param {json} response - Fetch all messages response + */ + + /** + * Fetch all messages service failure callback method. + * @callback fetchAllMessagesFailureCallback + * @param {json} error - Error information + */ + /** + * Fetch all messages + * @param {fetchAllMessagesSuccessCallback} successCallback - Callback method on success + * @param {fetchAllMessagesFailureCallback} failureCallback - Callback method on failure + */ + this.fetchAllMessages = function(startIndex, pageSize, successCallback, failureCallback) { + var uri = homeUrl + "/messages/fetch"; + + var data = { + "ksid": this.getKSID(), + "startElement": startIndex, + "elementsPerPage": pageSize + }; + var headers = { + "Content-Type": "application/json" + }; + var payload = { + postdata: JSON.stringify(data) + }; + + networkProvider.post(uri, payload, headers, successCallback, failureCallback); + }; + /** + * Update location service success callback method. + * @callback updateLocationSuccessCallback + * @param {json} response - Update location response + */ + + /** + * Update location service failure callback method. + * @callback updateLocationFailureCallback + * @param {json} error - Error information + */ + /** + * Update the location + * @param {string} latitude - Latitude value + * @param {string} longitude - Longitude value + * @param {string} locationName - Location name + * @param {updateLocationSuccessCallback} successCallback - Callback method on success + * @param {updateLocationFailureCallback} failureCallback - Callback method on failure + */ + this.updateGeoLocation = function(latitude, longitude, locationName, successCallback, failureCallback) { + if (typeof(latitude) === 'undefined' || latitude === null) { + throw new Exception(MESSAGING_FAILURE, "invalid latitude paramter value"); + } + if (typeof(longitude) === 'undefined' || longitude === null) { + throw new Exception(MESSAGING_FAILURE, "invalid longitude paramter value"); + } + if (typeof(locationName) === 'undefined' || locationName === null) { + throw new Exception(MESSAGING_FAILURE, "invalid locationName paramter value"); + } + + var uri = homeUrl + "/location"; + var data = { + "ksid": this.getKSID(), + "latitude": latitude, + "locname": locationName, + "longitude": longitude + }; + var headers = { + "Content-Type": "application/json" + }; + + var payload = { + postdata: JSON.stringify(data) + }; + logger.log("updateLocation payload: " + JSON.stringify(payload)); + networkProvider.post(uri, payload, headers, successCallback, failureCallback); + }; + /** + * Mark meesage as read service success callback method. + * @callback markReadSuccessCallback + * @param {json} response - Mark meesage as read service response + */ + /** + * Mark meesage as read service failure callback method. + * @callback markReadFailureCallback + * @param {json} error - Error information + */ + /** + * Mark the message as read for a given message id + * @param {string} messageId - Message id + * @param {markReadSuccessCallback} successCallback - Callback method on success + * @param {markReadFailureCallback} failureCallback - Callback method on failure + */ + this.markMessageRead = function(fetchId, successCallback, failureCallback) { + if (typeof(fetchId) === 'undefined' || fetchId === null) { + throw new Exception(MESSAGING_FAILURE, "invalid fetchId paramter value"); + } + var headers = {}; + headers["X-HTTP-Method-Override"] = "get"; + headers["Content-Type"] = "application/json"; + var uri = homeUrl + "/messages/open/" + fetchId; + networkProvider.post(uri, null, headers, successCallback, failureCallback); + + }; + /** + * Message content service success callback method. + * @callback messageContentSuccessCallback + * @param {json} response - Message content service response + */ + /** + * Message content service failure callback method. + * @callback messageContentFailureCallback + * @param {json} error - Error information + */ + /** + * Fetches the message conetent for a given message id + * @param {string} messageId - Message id + * @param {messageContentSuccessCallback} successCallback - Callback method on success + * @param {messageContentFailureCallback} failureCallback - Callback method on failure + */ + this.fetchMessageContent = function(fetchId, successCallback, failureCallback) { + if (typeof(fetchId) === 'undefined' || fetchId === null) { + throw new Exception(MESSAGING_FAILURE, "invalid fetchId paramter value"); + } + var uri = homeUrl + "/messages/content/" + fetchId; + networkProvider.post(uri, null, null, successCallback, failureCallback); + }; +}; +/** + * Method to create the Metrics service instance with the provided service name. + * @returns {MetricsService} Metrics service instance + */ +kony.sdk.prototype.getMetricsService = function() { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + if(!kony.sdk.isLicenseUrlAvailable) { + throw new Exception(Errors.METRICS_FAILURE, "metrics is not enabled"); + } + + //var metricsServiceObject = null; + if (this.metricsServiceObject) { + return this.metricsServiceObject; + } + + if (this.internalSdkObject) { + //framework implementation + this.metricsServiceObject = this.internalSdkObject.getMetricsService(); + } else { + //sdk local implementation + this.metricsServiceObject = new MetricsService(this); + } + return this.metricsServiceObject; +}; + +/** + * Should not be called by the developer. + * @class + * @classdesc Metrics service instance for invoking the Metrics services. + */ +function MetricsService(konyRef) { + var logger = new konyLogger(); + var url = konyRef.customReportingURL; + if (typeof(url) === 'undefined') { + throw new Exception(Errors.METRICS_FAILURE, "reporting url is undefined"); + return; + } + var networkProvider = new konyNetworkProvider(); + + + /** + * invoke the getUserId operation + */ + + this.getUserId = function(userId) { + return konyRef.getUserId(); + } + + //start of event api + var eventFlowTag = ""; + var eventBufferMaxValue = 1000; + var eventBufferAutoFlushValue = 15; + var characterLengthLimit = 256; + var eventConfig = { + "confType": "BUFFER", + "eventBufferAutoFlushCount": eventBufferAutoFlushValue, + "eventBufferMaxCount": eventBufferMaxValue + }; + var reportEventBufferArray = []; + var reportEventBufferBackupArray = []; + var retrievedDS = false; + var eventBufferCount = 0; + var eventTypeMap = { + "formentry": "FormEntry", + "formexit": "FormExit", + "touch": "Touch", + "servicerequest": "ServiceRequest", + "serviceresponse": "ServiceResponse", + "gesture": "Gesture", + "orientation": "Orientation", + "error": "Error", + "exception": "Exception", + "crash": "Crash", + "custom": "Custom", + "servicecall": "ServiceCall" + }; + var errorCodeMap = { + "1000": true, + "1011": true, + "1012": true, + "1014": true, + "1015": true, + "1016": true + }; + var currentSessionId = ""; + /** + * This method will take the a String to set a Flow Tag for the reported events. + * @param {string} flowTag - sets flow tag for reporting the events. + */ + this.setFlowTag = function(flowTag) { + if (kony.sdk.isNullOrUndefined(flowTag)) { + throw new Exception(Errors.METRICS_FAILURE, "Invalid value for event flow tag"); + } else if (flowTag.length <= characterLengthLimit) { + eventFlowTag = flowTag; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + characterLengthLimit + " characters"); + } + }; + + /** + * This method will clear the flow tag set by the user previously. + */ + this.clearFlowTag = function() { + eventFlowTag = ""; + }; + + /** + * This method will return the a String to set a Flow Tag for the reported events. + * @return {string} flowTag - flow tag set by the user for reporting the events. + */ + this.getFlowTag = function() { + return eventFlowTag; + }; + + /** + * This method will take the required values to set the event Configuration values. + * @param {string} confType - sets the Current Configuration Type + * possible values BUFFER or INSTANT. + * @param {number} eventBufferAutoFlushCount - event buffer count to auto flush the events + * possible values any positive integer + * Default value 15 + * @param {number} eventBufferMaxCount - Maximum event buffer count to store the events + * possible values any positive integer + * Default value 1000 + */ + this.setEventConfig = function(confType, eventBufferAutoFlushCount, eventBufferMaxCount) { + if (kony.sdk.isNullOrUndefined(confType)) { + throw new Exception(Errors.METRICS_FAILURE, "Config Type can not be null"); + } else { + confType = confType.toUpperCase(); + } + if (confType === "BUFFER") { + eventConfig["confType"] = confType; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Invalid value for config type"); + } + if (!kony.sdk.isNullOrUndefined(eventBufferMaxCount) && typeof(eventBufferMaxCount) === "number" && eventBufferMaxCount > 0) { + eventConfig["eventBufferMaxCount"] = eventBufferMaxCount; + } else { + throw new Exception(Errors.METRICS_FAILURE, "eventBufferMaxCount has to be a Number and greater than 0"); + } + if (!kony.sdk.isNullOrUndefined(eventBufferAutoFlushCount) && typeof(eventBufferAutoFlushCount) === "number" && eventBufferAutoFlushCount > 0 && eventBufferAutoFlushCount <= eventBufferMaxCount) { + eventConfig["eventBufferAutoFlushCount"] = eventBufferAutoFlushCount; + } else if (eventBufferAutoFlushCount >= eventBufferMaxCount) { + eventConfig["eventBufferMaxCount"] = 1000; + throw new Exception(Errors.METRICS_FAILURE, "eventBufferAutoFlushCount can not be greater than eventBufferMaxCount"); + } else { + throw new Exception(Errors.METRICS_FAILURE, "eventBufferAutoFlushCount has to be a Number and greater than 0"); + } + }; + + /** + * This method takes the event details from the developer and schedule it for sending to server as per Configuration values set by the developer. + * @param {string} evttype - Event Type for the reported event. + * @param {string} evtSubType - string literal for eventSubType(max 256 Chars) + * @param {string} formID - string literal for formID(max 256 Chars) + * @param {string} widgetID - string literal for widgetID(max 256 Chars) + * @param {string} flowTag - string literal to override flow tag (max 256 Chars) + * @param {string} metaData - string to describe metaData + * @throws Exception + */ + + this.sendEvent = function(evttype, evtSubType, formID, widgetID, flowTag, metaData) { + if (reportEventBufferBackupArray.length === 0) { + this.readFromDS(); + } + eventBufferCount = reportEventBufferBackupArray.length + reportEventBufferArray.length; + + if (eventBufferCount === eventConfig["eventBufferMaxCount"]) { + throw new Exception(Errors.DATA_STORE_EXCEPTION, "Reached maximum limit to store events"); + return; + } + var reportEventMap = {}; + reportEventMap.ts = kony.sdk.formatCurrentDate(new Date()); + evttype = evttype.toLowerCase(); + if (kony.sdk.isNullOrUndefined(eventTypeMap[evttype])) { + throw new Exception(Errors.METRICS_FAILURE, "Invalid value for event type"); + return; + } else { + reportEventMap["evttype"] = eventTypeMap[evttype]; + } + if (kony.sdk.isNullOrUndefined(evtSubType)) { + reportEventMap["evtSubType"] = ""; + } else if (evtSubType.length <= characterLengthLimit) { + reportEventMap["evtSubType"] = evtSubType; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + characterLengthLimit + " characters"); + return; + } + if (kony.sdk.isNullOrUndefined(formID)) { + reportEventMap["formID"] = kony.application.getCurrentForm().id; + } else if (formID.length <= characterLengthLimit) { + reportEventMap["formID"] = formID; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + characterLengthLimit + " characters"); + return; + } + if (kony.sdk.isNullOrUndefined(widgetID)) { + reportEventMap["widgetID"] = ""; + } else if (widgetID.length <= characterLengthLimit) { + reportEventMap["widgetID"] = widgetID; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + characterLengthLimit + " characters"); + return; + } + if (kony.sdk.isNullOrUndefined(flowTag)) { + reportEventMap["flowTag"] = this.getFlowTag(); + } else if (flowTag.length <= characterLengthLimit) { + reportEventMap["flowTag"] = flowTag; + } else { + throw new Exception(Errors.METRICS_FAILURE, "Length exceeded, Maximum length of event flow tag is " + characterLengthLimit + " characters"); + return; + } + reportEventMap.SID = currentSessionId; + reportEventMap.metaData = metaData; + //checking each event data is a proper json or not + // if (!kony.sdk.isJson(reportEventMap)) { + // throw new Exception(Errors.METRICS_FAILURE, "Invalid json string passed for events data"); + // } + + reportEventBufferArray.push(reportEventMap); + + if (reportEventBufferArray.length % eventConfig["eventBufferAutoFlushCount"] === 0) { + this.flushEvents(); + } + }; + + /** + * This method will send the buffered events to the server at once. + */ + + this.flushEvents = function() { + var logger = new konyLogger(); + var ref = this; + if (reportEventBufferBackupArray.length === 0) { + ref.readFromDS(); + } + if (reportEventBufferBackupArray.length === 0 && reportEventBufferArray.length === 0) { + logger.log("There are no events to flush"); + return; + } + var payload = kony.sdk.getPayload(kony.sdk.getCurrentInstance()); + var params = {}; + if (reportEventBufferArray.length !== 0) { + ref.pushEventsToBufferArray(); + } + var headers = { + "Content-Type": "application/x-www-form-urlencoded" + }; + params.httpheaders = headers; + payload.events = reportEventBufferBackupArray; + payload.svcid = "SendEvents"; + payload.rsid = reportEventBufferBackupArray[0].SID; + params.konyreportingparams = JSON.stringify(payload); + kony.net.invokeServiceAsync(kony.sdk.currentInstance.customReportingURL, params, flushCallback); + + function flushCallback(status, response) { + if (status === 400) { + if (response.opstatus === 0) { + ref.clearBufferEvents(); + } else if (errorCodeMap[response.opstatus]) { + ref.saveInDS(); + } else { + ref.clearBufferEvents(); + } + } else if (status === 300) { + ref.saveInDS(); + } + } + }; + + /*Stores event data in Data Store on failure of service Call*/ + this.saveInDS = function() { + var eventsToSave = []; + eventsToSave.push(JSON.stringify(reportEventBufferBackupArray)); + kony.ds.save(eventsToSave, "konyMetricsBuffer"); + reportEventBufferBackupArray = []; + }; + + /*Clearing events sent to server */ + this.clearBufferEvents = function() { + reportEventBufferBackupArray = []; + kony.ds.remove("konyMetricsBuffer"); + }; + + /*Reading any pending events from Data Store */ + this.readFromDS = function() { + var eventsFromDS = kony.ds.read("konyMetricsBuffer"); + if (eventsFromDS !== null) { + var pushToArray = []; + pushToArray.push(JSON.parse(eventsFromDS[0])); + reportEventBufferBackupArray.push.apply(reportEventBufferBackupArray, pushToArray); + } + }; + + /*Pushes events received from user to BufferBackupArray which will be flushed to server */ + this.pushEventsToBufferArray = function() { + reportEventBufferBackupArray.push.apply(reportEventBufferBackupArray, reportEventBufferArray); + reportEventBufferArray = []; + }; + + /** + * This method will return the a List of the buffered events. + * @return {object} events - list of events stored in buffer. + */ + + this.getEventsInBuffer = function() { + var eventsFromDS = kony.ds.read("konyMetricsBuffer"); + var eventsToReturn = []; + if (!kony.sdk.isNullOrUndefined(eventsFromDS)) { + eventsToReturn.push(JSON.parse(eventsFromDS[0])); + } + if (reportEventBufferArray.length !== 0) { + eventsToReturn.push.apply(eventsToReturn, reportEventBufferArray); + } + if (eventsToReturn.length !== 0) { + return eventsToReturn; + } else { + return null; + } + }; + + /** + * invoke the sendCustomMetrics operation + * @param {string} reportingGroupID - reporting Group ID + * @param {object} metrics - metrics being reported + */ + this.sendCustomMetrics = function(reportingGroupID, metrics) { + if (typeof(metrics) !== "object") { + throw new Exception(Errors.METRICS_FAILURE, "Invalid type for metrics data."); + return; + } + var sessionID = currentSessionId; + var reportData = konyRef.getDataStore().getItem("konyCustomReportData"); + if (!reportData) { + reportData = new Array(); + } else { + reportData = JSON.parse(reportData); + } + + konyRef.getDataStore().removeItem("konyCustomReportData"); + + var currentData = {}; + currentData.ts = kony.sdk.formatCurrentDate(new Date().toString()); + currentData.fid = reportingGroupID; + currentData.metrics = metrics; + currentData.rsid = sessionID; + reportData.push(currentData); + //nyRef.getDataStore().setItem("konyCustomReportData",JSON.stringify(reportData)); + var payload = kony.sdk.getPayload(konyRef); + if (kony.sdk.metric) { + if (kony.sdk.metric.reportEventBufferBackupArray.length === 0) { + kony.sdk.metric.readFromDS(); + } + kony.sdk.metric.pushEventsToBufferArray(); + payload.events = kony.sdk.metric.reportEventBufferBackupArray; + } + payload.reportData = reportData; + payload.rsid = sessionID; + payload.svcid = "CaptureKonyCustomMetrics"; + // if (!kony.sdk.isJson(payload)) { + // throw new Exception(Errors.METRICS_FAILURE, "Invalid json string passed for custom metrics"); + // } + var newData = {}; + newData["konyreportingparams"] = JSON.stringify(payload); + + networkProvider.post(url, newData, { + "Content-Type": "application/x-www-form-urlencoded" + }, function(res) { + //successcallback + //konyRef.getDataStore().removeItem("konyCustomReportData"); + if (kony.sdk.metric) { + kony.sdk.metric.clearBufferEvents(); + } + logger.log("metric data successfully sent" + JSON.stringify(res)); + }, + function(res) { + + var storeData = konyRef.getDataStore().getItem("konyCustomReportData"); + if (!storeData) { + storeData = new Array(); + } else { + storeData = JSON.parse(storeData); + } + if (kony.sdk.metric) { + if (kony.sdk.metric.errorCodeMap[res.opstatus]) { + kony.sdk.metric.saveInDS(); + } + } + storeData.push(reportData); + konyRef.getDataStore().setItem("konyCustomReportData", JSON.stringify(storeData)); + + logger.log("Unable to send metric report" + JSON.stringify(res)); + }, true); + }; + + /** + * This method takes the event details from the developer and schedule it for sending to server as per Configuration values set by the developer. + * @param {string} errorCode - errorCode of the reported error. Can be empty if not applicable + * @param {string} errorType - errorType of the reported error. Can be empty if not applicable + * @param {string} errorMessage - errorMessage of the reported error. Can be empty if not applicable + * @param {json} errorDetails - errorDetails of the reported error as a json string that can have key-value pairs for the following + keys errfile, errmethod, errline, errstacktrace, formID, widgetID, flowTag. + * @throws Exception + */ + + this.reportError = function(errorCode, errorType, errorMessage, errorDetails) { + var metaData = {}; + metaData.errorcode = errorCode ? errorCode : ""; + metaData.errmsg = errorMessage ? errorMessage : ""; + if (errorDetails && kony.sdk.isJson(errorDetails)) { + metaData.errfile = errorDetails.errfile ? errorDetails.errfile : ""; + metaData.errmethod = errorDetails.errmethod ? errorDetails.errmethod : ""; + metaData.errline = errorDetails.errline ? errorDetails.errline : ""; + metaData.errstacktrace = errorDetails.errstacktrace ? errorDetails.errstacktrace : ""; + metaData.errcustommsg = errorDetails.errcustommsg ? errorDetails.errcustommsg : ""; + var formID = errorDetails.formID ? errorDetails.formID : ""; + var widgetID = errorDetails.widgetID ? errorDetails.widgetID : ""; + var flowTag = errorDetails.flowTag ? errorDetails.flowTag : ""; + var evtSubType = errorType ? errorType : ""; + this.sendEvent("Error", evtSubType, formID, widgetID, flowTag, metaData); + } else { + throw new Exception(Errors.METRICS_FAILURE, "Invalid json string passed for error details."); + } + }; + + + /** + * This method takes the event details from the developer and schedule it for sending to server as per Configuration values set by the developer. + * @param {string} exceptionCode - Code for the reported exception. Can be empty if not applicable + * @param {string} exceptionType - Type of the reported exception. Can be empty if not applicable + * @param {string} exceptionMessage - Message of the reported exception. Can be empty if not applicable + * @param {json} exceptionDetails - Details of the reported exception as a JSON string that can have key-value pairs for the + following keys exceptioncode, exceptionfile, exceptionmethod, exceptionline, + exceptionstacktrace, formID, widgetID, flowTag. + * @throws Exception + */ + + this.reportHandledException = function(exceptionCode, exceptionType, exceptionMessage, exceptionDetails) { + var metaData = {}; + metaData.exceptioncode = exceptionCode ? exceptionCode : ""; + metaData.exceptionmsg = exceptionMessage ? exceptionMessage : ""; + if (exceptionDetails && kony.sdk.isJson(exceptionDetails)) { + metaData.errfile = exceptionDetails.errfile ? exceptionDetails.errfile : ""; + metaData.errmethod = exceptionDetails.errmethod ? exceptionDetails.errmethod : ""; + metaData.errline = exceptionDetails.errline ? exceptionDetails.errline : ""; + metaData.errstacktrace = exceptionDetails.errstacktrace ? exceptionDetails.errstacktrace : ""; + metaData.errcustommsg = exceptionDetails.errcustommsg ? exceptionDetails.errcustommsg : ""; + var formID = exceptionDetails.formID ? exceptionDetails.formID : ""; + var widgetID = exceptionDetails.widgetID ? exceptionDetails.widgetID : ""; + var flowTag = exceptionDetails.flowTag ? exceptionDetails.flowTag : ""; + var evtSubType = exceptionType ? exceptionType : ""; + this.sendEvent("Exception", evtSubType, formID, widgetID, flowTag, metaData); + } else { + throw new Exception(Errors.METRICS_FAILURE, "Invalid json string passed for exception details."); + } + }; + + /** + * sets the current sessionId + * @param {string} sessionId + */ + + this.setSessionId = function(sessionId) { + if (sessionId) { + currentSessionId = sessionId; + } + } + + /** + * get the current sessionID + * + */ + + + this.getSessionId = function() { + return currentSessionId; + } + + /** + * stub method used for event tracking + * + */ + this.setEventTracking = function(eventTypes) { + // Stub. This is implemented in native->js binding + } +} + + +//stub method +kony.sdk.initiateSession = function() { + return; +} + +kony.sdk.prototype.registerObjectService = function(objectServiceType, objectServiceClass) { + kony.sdk.registeredobjsvcs = {} || kony.sdk.registeredobjsvcs; + kony.sdk.registeredobjsvcs[objectServiceType] = objectServiceClass; +}; +/** + * Method to create the object service instance with the provided service name. + * @param {string} serviceName - Name of the service + * @param {map} options - Map of key values like access flag + * @returns {IObjectService} Object service instance + */ +kony.sdk.prototype.getObjectService = function(serviceName, options) { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + + var access; + if (options != undefined && options != null) { + access = options["access"]; + } + + var logger = new konyLogger(); + + if (this.objectsvc != null) { + if (this.objectsvc[serviceName] != null) { + logger.log("found Object service" + this.objectsvc[serviceName]); + if(access == undefined || access == null || access.toLowerCase() == "online") { + return new kony.sdk.OnlineObjectService(this, serviceName); + } else if(access.toLowerCase() == "offline") { + return new kony.sdk.OfflineObjectService(this, serviceName); + } else { + kony.sdk.registeredobjsvcs = {} || kony.sdk.registeredobjsvcs; + //verifying if the servicetype available in registeredservices if available initialize and return + if (kony.sdk.registeredobjsvcs[access] != null && kony.sdk.registeredobjsvcs[access] != undefined) { + return new kony.sdk.registeredobjsvcs[access](this, serviceName); + } else { + throw new Exception(Errors.OBJECT_FAILURE, "Invalid access value:"+access); + } + } + } + + } + + throw new Exception(Errors.OBJECT_FAILURE, "Invalid serviceName:"+serviceName); + +}; + +kony.sdk.IObjectService = function(konyRef, serviceName) { + this.konyRef = konyRef; + this.serviceName = serviceName; + this.create = function(options, successCallback, failureCallback) { + throw "This method is not implemented."; + }; + + this.fetch = function(options, successCallback, failureCallback) { + throw "This method is not implemented."; + }; + + this.update = function(options, successCallback, failureCallback) { + throw "This method is not implemented."; + }; + + this.deleteRecord = function(options, successCallback, failureCallback) { + throw "This method is not implemented."; + }; + + this.getMetadataOfAllObjects = function(options, successCallback, failureCallback) { + throw "This method is not implemented."; + }; + + this.getMetadataOfObject = function(objectName, options, successCallback, failureCallback) { + throw "This method is not implemented."; + }; +}; + +kony.sdk.OfflineObjectService = function(konyRef, serviceName) { + this.konyRef = konyRef; + this.serviceName = serviceName; + + this.create = function(options, successCallback, failureCallback) { + var dataObject = options["dataObject"]; + this.getMetadataOfObject(dataObject.getObjectName(),{},createHandler,failureCallback); + + function createHandler(objMetadata){ + var record = dataObject.getRecord(); + + var recordObject = new kony.sdk.dto.RecordObject(); + recordObject.tableName = dataObject.getObjectName(); + recordObject.columnValues = populateColumnValues(record,recordObject.childRecords); + + _invokeOfflineCreate(recordObject,successCallback, failureCallback); + } + }; + + this.fetch = function(options, successCallback, failureCallback) { + var dataObject = options["dataObject"]; + this.getMetadataOfObject(dataObject.getObjectName(),{},fetchHandler,failureCallback); + function fetchHandler(objMetadata) { + var selectQueryObj = dataObject.getSelectQueryObject(); + var query = selectQueryObj.toString(); + var dbName = kony.sdk.util.getSyncDbName(); + + kony.sync.single_select_execute(dbName, query, null, + selectSuccessCallback, selectErrorCallback); + function selectSuccessCallback(response) { + var responseJSONArray = []; + if (response !== null) { + for ( var i in response) { + var responseObject = response[i]; + var responseJSONObject = {}; + if (selectQueryObj.getColumns().length !== 0) { + for ( var j = 0; j < selectQueryObj.getColumns().length; j++) { + var eachColumn = selectQueryObj.getColumns()[j]; + var columnName = eachColumn.getName(); + responseJSONObject[columnName] = responseObject[columnName]; + } + } + responseJSONArray.push(responseJSONObject); + } + } + var responseObj = {}; + responseObj["records"] = responseJSONArray; + kony.sdk.verifyAndCallClosure(successCallback, responseObj); + } + + function selectErrorCallback(error) { + kony.sdk.verifyAndCallClosure(failureCallback, error); + } + } + }; + + this.update = function(options, successCallback, failureCallback) { + var dataObject = options["dataObject"]; + this.getMetadataOfObject(dataObject.getObjectName(),{},updateHandler,failureCallback); + function updateHandler(objMetadata) { + var record = dataObject.getRecord(); + + var recordObject = new kony.sdk.dto.RecordObject(); + recordObject.tableName= dataObject.getObjectName(); + recordObject.columnValues = populateColumnValues(record,recordObject.childRecords); + + _invokeOfflineUpdate(recordObject, successCallback, failureCallback); + } + }; + + this.deleteRecord = function(options, successCallback, failureCallback) { + var dataObject = options["dataObject"]; + this.getMetadataOfObject(dataObject.getObjectName(),{},deleteHandler,failureCallback); + function deleteHandler(objMetadata) { + kony.sdk.util.deleteRecordCascade(serviceName, dataObject, delSuccCallback, delErrCallback); + function delSuccCallback(result) { + var response = {}; + if (result !== null && result !== undefined + && result.hasOwnProperty("deletedRecords")) { + response.deletedRecords = result.deletedRecords; + } + kony.sdk.verifyAndCallClosure(successCallback, response); + } + function delErrCallback(error) { + kony.sdk.verifyAndCallClosure(failureCallback, error); + } + } + }; + + this.getMetadataOfAllObjects = function(options, successCallback, failureCallback) { + var objectsMetadata = kony.sdk.ObjectServiceUtil.getCachedMetadata(serviceName); + if (objectsMetadata == null || objectsMetadata == undefined) { + var tmpOptions = {"access":"online"}; + //getting online objectservice to get metadata + var tmpOnlineObjSer = kony.sdk.getCurrentInstance().getObjectService(this.serviceName,tmpOptions); + tmpOnlineObjSer.getMetadataOfAllObjects({"getFromServer":true}, successHandler, errorHandler); + } else { + successHandler(objectsMetadata); + } + function successHandler(objectsMetadata) { + kony.sdk.verifyAndCallClosure(successCallback, objectsMetadata); + } + function errorHandler(error) { + kony.sdk.verifyAndCallClosure(failureCallback, error); + } + }; + + this.getMetadataOfObject = function(objectName, options, successCallback, failureCallback) { + var objectMetadata = kony.sdk.ObjectServiceUtil.getCachedObjectMetadata(serviceName, objectName); + + if (objectMetadata == null || objectMetadata == undefined) { + var tmpOptions = {"access":"online"}; + //getting online objectservice to get metadata Of all Objects to avoid multiple calls in offline scenario + var tmpOnlineObjSer = kony.sdk.getCurrentInstance().getObjectService(this.serviceName,tmpOptions); + tmpOnlineObjSer.getMetadataOfAllObjects({"getFromServer":true}, successHandler, errorHandler); + } else { + kony.sdk.verifyAndCallClosure(successCallback, objectMetadata); + } + + function successHandler(objectsMetadata) { + var tmpObjMetadata = kony.sdk.ObjectServiceUtil.getCachedObjectMetadata(serviceName, objectName); + kony.sdk.verifyAndCallClosure(successCallback, tmpObjMetadata); + } + function errorHandler(error) { + kony.sdk.verifyAndCallClosure(failureCallback, error); + } + }; + + this.executeSelectQuery = function(queryStr, successCallback, failureCallback) { + + kony.sync.single_select_execute(kony.sdk.util.getSyncDbName(),queryStr,null,selctSuccess, selectError); + function selctSuccess(response) { + kony.sdk.verifyAndCallClosure(successCallback, response); + } + + function selectError(error) { + kony.sdk.verifyAndCallClosure(failureCallback, error); + } + }; + + this.getBinaryBase64OfColumn = function(options, successCallback, failureCallback) { + var dataObject = options["dataObject"]; + this.getMetadataOfObject(dataObject.getObjectName(),{},getBinaryDataHandler,failureCallback); + function getBinaryDataHandler(objMetadata) { + var dbName = kony.sdk.util.getSyncDbName(); + var objName = dataObject.getObjectName(); + var columnValues = populateColumnValues(dataObject.getRecord(),null); + var binaryColName = null; + if (columnValues != null && columnValues != undefined) { + var columnValuesLen = Object.keys(columnValues).length; + for (var index = 0; index < columnValuesLen; index++) { + var colName = Object.keys(record)[index]; + //identifying the binary column name + if(objMetadata != null && objMetadata[colName]["datatype"] == kony.sdk.constants["binary"]) { + binaryColName = colName; + break; + } + } + } else { + //TODO + kony.sdk.verifyAndCallClosure(failureCallback, "Please provide column name to fetch binary content"); + return; + } + if(binaryColName == null) { + //TODO + kony.sdk.verifyAndCallClosure(failureCallback, "Please provide column name to fetch binary content"); + return; + } + var pkTable = kony.sdk.util.getPkTable(objMetadata, columnValues, failureCallback); + + kony.sync.single_binary_select_base64_execute(dbName, objName, binaryColName, pkTable, null, + selectSuccessCallback, selectErrorCallback); + + function selectSuccessCallback(response) { + var responseJSONArray = []; + if (response !== null) { + var base64Str = response["base64"]; + var responseJSONObject = {}; + responseJSONObject[binaryColName] = base64Str; + responseJSONArray.push(responseJSONObject); + } + var responseObj = {}; + responseObj["records"] = responseJSONArray; + kony.sdk.verifyAndCallClosure(successCallback, responseObj); + } + + function selectErrorCallback(error) { + kony.sdk.verifyAndCallClosure(failureCallback, error); + } + } + }; + + this.getBinaryFilePathOfColumn = function(options, successCallback, failureCallback) { + var dataObject = options["dataObject"]; + this.getMetadataOfObject(dataObject.getObjectName(),{},getBinaryDataHandler,failureCallback); + function getBinaryDataHandler(objMetadata) { + var dbName = kony.sdk.util.getSyncDbName(); + var objName = dataObject.getObjectName(); + var columnValues = populateColumnValues(dataObject.getRecord(),null); + var binaryColName = null; + if (columnValues != null && columnValues != undefined) { + var columnValuesLen = Object.keys(columnValues).length; + for (var index = 0; index < columnValuesLen; index++) { + var colName = Object.keys(record)[index]; + //identifying the binary column name + if(objMetadata != null && objMetadata[colName]["datatype"] == kony.sdk.constants["binary"]) { + binaryColName = colName; + break; + } + } + } else { + //TODO + kony.sdk.verifyAndCallClosure(failureCallback, "Please provide column name to fetch binary content"); + return; + } + if(binaryColName == null) { + //TODO + kony.sdk.verifyAndCallClosure(failureCallback, "Please provide column name to fetch binary content"); + return; + } + var pkTable = kony.sdk.util.getPkTable(objMetadata, columnValues, failureCallback); + + kony.sync.single_binary_select_file_execute(dbName, objName, binaryColName, pkTable, null, + selectSuccessCallback, selectErrorCallback); + + function selectSuccessCallback(response) { + var responseJSONArray = []; + if (response !== null) { + var filePathStr = response["filePath"]; + var responseJSONObject = {}; + responseJSONObject[binaryColName] = filePathStr; + responseJSONArray.push(responseJSONObject); + } + var responseObj = {}; + responseObj["records"] = responseJSONArray; + kony.sdk.verifyAndCallClosure(successCallback, responseObj); + } + + function selectErrorCallback(error) { + kony.sdk.verifyAndCallClosure(failureCallback, error); + } + } + }; + + function populateColumnValues(record,childRecords){ + var columnValues = {}; + var recordsLength = Object.keys(record).length; + for (var index = 0; index < recordsLength; index++) { + var colName = Object.keys(record)[index]; + var colVal = record[colName]; + if (colVal instanceof Array) { + for(var tempIndex = 0;tempIndex", + name : "GREATER" + }, + GREATEREQUAL : { + value : ">=", + name : "GREATEREQUAL" + }, + LESS : { + value : "<", + name : "LESS" + }, + LESSEQUAL : { + value : "<=", + name : "LESSEQUAL" + }, + STARTSWITH : { + value : "LIKE", + name : "STARTSWITH" + }, + CONTAINS : { + value : "LIKE", + name : "CONTAINS" + }, + LIKE : { + value : "LIKE", + name : "LIKE" + }, + ENDSWITH : { + value : "LIKE", + name : "ENDSWITH" + }, + NOTEQUAL : { + value : "<>", + name : "NOTEQUAL" + }, + ISNULL : { + value : "IS NULL", + name : "ISNULL" + }, + ISNOTNULL : { + value : "IS NOT NULL", + name : "ISNOTNULL" + } +}; + +kony.sdk.constants.JoinType = { + INNER : "INNER", + LEFT : "LEFT", + RIGHT : "RIGHT" + +}; +kony.sdk.constants.Operator = { + AND : "AND", + OR : "OR" +}; + + +/** + * This is a utility function used to check whether the two strings provided + * would match with each other. + * + * @package Utils + * @param string + * string1 + * @param string + * string2 + * @return boolean + */ +kony.sdk.util.matchIgnoreCase = function(string1, string2) { + if (string1 === null || string2 === null || string1 === undefined + || string2 === undefined) { + return false; + } + return (string1.toUpperCase() === string2.toUpperCase()); +}; + +kony.sdk.util.isNull = function(val) { + if (val === null || val === undefined) + return true; + val = val + ""; + return (kony.sdk.util.matchIgnoreCase(val, "null")); +}; + +kony.sdk.util.isValidNumberType = function(val) { + if (kony.sdk.util.matchIgnoreCase(typeof val, "number")) + return true; + else if (kony.sdk.util.matchIgnoreCase(typeof val, "string") + && null != kony.sdk.util.toNumber(val)) + return true; + else + return false; + +}; + +kony.sdk.util.toNumber = function(arg) { + if (arguments.length != 1) { + throw new Error("Invalid argument to kony.sdk.util.toNumber"); + } + if (typeof (arg) === "number") { + return arg; + } else if (typeof (arg) === "string") { + var str = arg.replace(/^\s*/, '').replace(/\s*$/, ''); + if (str === '') { + return null; + } else { + var num = str - 0; + return (isNaN(num) ? null : num); + } + } else { + return null; + } +}; + +kony.sdk.util.validateCriteriaObject = function(criteria) { + if (criteria !== null && criteria !== undefined) { + return (criteria instanceof kony.sdk.dto.Criteria || criteria instanceof kony.sdk.dto.Match + || criteria instanceof kony.sdk.dto.Between + || criteria instanceof kony.sdk.dto.LogicGroup || criteria instanceof kony.sdk.dto.And + || criteria instanceof kony.sdk.dto.Or || criteria instanceof kony.sdk.dto.Not + || criteria instanceof kony.sdk.dto.Expression + || criteria instanceof kony.sdk.dto.InCriteria || criteria instanceof kony.sdk.dto.Exists + || criteria instanceof kony.sdk.dto.Join); + } else { + return false; + } +}; + +kony.sdk.ObjectServiceUtil.cacheMetadata = function(serviceName, objects){ + if(objects !== undefined && objects !== null){ + kony.store.removeItem(serviceName); + for (var i = 0; i < objects.length; i++) { + var object = objects[i]; + //clearing the existing metadata of service and updating it with the latest metadata + kony.sdk.ObjectServiceUtil.cacheObjectMetadata(serviceName, object); + } + } +}; + +kony.sdk.ObjectServiceUtil.cacheObjectMetadata = function(serviceName, object){ + if(object !== undefined && object !== null){ + //getting metadata of servicename + var metadataOfAllObjs = kony.store.getItem(serviceName); + var jsonObject = JSON.parse('{}'); + //if metadata available get it + if (metadataOfAllObjs !== null && metadataOfAllObjs !== undefined && metadataOfAllObjs !== "{}") { + jsonObject = JSON.parse(metadataOfAllObjs); + } + //adding metadata of object to the existing metadata + jsonObject[object.name] = object; + var jsonStr = JSON.stringify(jsonObject); + kony.store.setItem(serviceName, jsonStr); + } +}; + +kony.sdk.ObjectServiceUtil.getCachedMetadata = function(serviceName){ + + //reading metadata from the store + var metadataOfAllObjs = kony.store.getItem(serviceName); + var jsonObject = null; + if (metadataOfAllObjs !== null && metadataOfAllObjs !== undefined && metadataOfAllObjs !== "{}") { + jsonObject = JSON.parse(metadataOfAllObjs); + } + return jsonObject; +}; + +kony.sdk.ObjectServiceUtil.getCachedObjectMetadata = function(serviceName, objectName){ + var objectMetadata; + if(objectName !== undefined && objectName !==null){ + //reading metadata from the store + var metadataOfAllObjs = kony.store.getItem(serviceName); + var jsonObject = null; + if (metadataOfAllObjs !== null && metadataOfAllObjs !== undefined && metadataOfAllObjs !== "{}") { + jsonObject = JSON.parse(metadataOfAllObjs); + //getting the object's metadata from the stored metadata + objectMetadata = jsonObject[objectName]; + } + } + return objectMetadata; +} + +// This function is responsible for checking if the array contains the object based on object's name property. +// returns the array element if the object matches +kony.sdk.util.getExtendedFieldsFromArray = function(array, object){ + if(array instanceof Array){ + for(var i=0; i -1) { + if (obj !== null) { + if (obj instanceof kony.sdk.dto.Column) { + listBuffer = listBuffer.concat(obj.toString()); + } else { + listBuffer = listBuffer.concat(obj.toString()); + } + } + } else if (obj !== null && obj !== undefined) { + listBuffer = listBuffer.concat(obj.toString()); + } + if (i < objectList.length - 1) { + listBuffer = listBuffer.concat(seperator); + } + } + return listBuffer; + }; +}; + +kony.sdk.dto.RecordObject = function(){ + this.tableName = ""; + this.columnValues = {}; + this.childRecords = []; +} + +/** + * This function is the Table constructor. + * + * @package com.kony.common.DataAccess.Query + * @param tableName, + * tableAlias + */ +kony.sdk.dto.Table = function(tableName, tableAlias,junctionType) { + this.name = tableName; + this.alias = tableAlias; + this.isjunction = junctionType; + + this.getAlias = function() { + return this.alias; + }; + /** + * This function is used to set alias. + * + * @param alias + */ + this.setAlias = function(alias) { + this.alias = alias; + }; + this.getName = function() { + return this.name; + }; + /** + * This function is used to set name. + * + * @param name + */ + this.setName = function(name) { + this.name = name; + }; + /** + * This function is used to check object equality. + * + * @param obj + * @return Boolean + */ + this.equals = function(obj) { + var areObjectsEqual = false; + if (obj === null || obj === undefined) { + areObjectsEqual = false; + } else if (typeof (this) === typeof (obj)) { + areObjectsEqual = true; + + if (this.hasAlias() && obj.hasAlias()) { + areObjectsEqual = this.getAlias() === obj.getAlias(); + } else { + areObjectsEqual = this.getName() === obj.getName(); + } + } else { + areObjectsEqual = false; + } + return areObjectsEqual; + }; + this.getColumn = function(columnName) { + return new kony.sdk.dto.Column(this, columnName); + }; + /** + * This function is used to check if alias is present or not. + * + * @return Boolean + */ + this.hasAlias = function() { + return (this.alias !== null && this.alias !== undefined); + }; + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + return this.getName() + (this.hasAlias() ? " " + this.getAlias() : ""); + }; + /** + * This function is used to return if the table is a junction table. + * + * @return boolean + */ + this.isJunction = function() { + return (this.isjunction && this.isjunction == true); + }; + /** + * This function is used to set the type of table junction/non-junction table. + * + * @param junctionType + */ + this.setJunction = function(junctionType) { + this.isjunction = junctionType; + }; +}; + + +kony.sdk.dto.Column = function(tableObj, colName) { + if (tableObj instanceof kony.sdk.dto.Table) { + this.aggregation = null; + this.alias = null; + this.dataType = null; + this.name = null; + this.table = null; + + if (colName !== undefined && colName !== null + && typeof (colName) === "string") { + this.name = colName; + } else { + //TODO + //throw error + } + this.table = tableObj; + } else { + //TODO + //throw error + } + + this.getAggregation = function() { + return this.aggregation; + }; + this.setAggregation = function(aggregation) { + this.aggregation = aggregation; + }; + this.getAlias = function() { + return this.alias; + }; + this.setAlias = function(alias) { + this.alias = alias; + }; + this.getDataType = function() { + return this.dataType; + }; + this.setDataType = function(dataType) { + this.dataType = dataType; + }; + this.isComputedField = function() { + return this.fieldComputed; + }; + this.setComputedField = function(fieldComputed) { + this.fieldComputed = fieldComputed; + }; + this.getName = function() { + return this.name; + }; + this.setName = function(name) { + if (name !== undefined && name !== null && typeof (name) === "string") { + this.name = name; + } else { + //TODO + //throw error + } + }; + this.getTable = function() { + return this.table; + }; + this.setTable = function(table) { + if (table instanceof kony.sdk.dto.Table) { + this.table = table; + } else { + //TODO + //throw error + } + }; + this.toStringByMode = function(mode) { + var tableName = (this.getTable().getAlias() !== null && this.getTable() + .getAlias() !== undefined) ? this.getTable().getAlias() : this + .getTable().getName(); + var constructedColumn = null; + var constructDataType = null; + var constructAlias = null; + var constructAggregation = null; + + switch (mode) { + case 0: + if (this.getDataType() !== null && this.getDataType() !== undefined) { + if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "Integer")) { + constructDataType = "CAST (" + tableName + "." + + this.getName() + " AS INTEGER)"; + } else if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "Numeric")) { + constructDataType = "CAST (" + tableName + "." + + this.getName() + " AS NUMERIC)"; + + } else if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "Date")) { + + constructDataType = "date(" + tableName + "." + + this.getName() + ")"; + + } else { + constructDataType = tableName + "." + this.getName(); + } + } else { + constructDataType = tableName + "." + this.getName(); + } + constructAlias = (this.getAlias() !== null + && this.getAlias() !== undefined && this.getAlias() !== "") ? " AS " + + this.getAlias() + : ""; + constructAggregation = (this.getAggregation() === kony.sdk.constants.Aggregation.NONE || (this + .getAggregation() === null || this.getAggregation() === undefined)) ? constructDataType + : (this.isComputedField()? this.getAggregation() : this.getAggregation() + "(" + constructDataType + ")" ) ; + constructedColumn = constructAggregation + constructAlias; + break; + case 1: + if (this.getDataType() !== null && this.getDataType() !== undefined) { + if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "STRING")) + this.setDataType("text"); + } + constructDataType = (this.getDataType() !== null && this + .getDataType() !== undefined) ? "CAST (" + tableName + "." + + this.getName() + " AS " + this.getDataType() + ")" + : tableName + "." + this.getName(); + constructAggregation = (this.getAggregation() === kony.sdk.constants.Aggregation.NONE || (this + .getAggregation() === null || this.getAggregation() === undefined)) ? constructDataType + : (this.isComputedField()? this.getAggregation() : this.getAggregation() + "(" + constructDataType + ")" ) ; + constructedColumn = constructAggregation; + break; + case 2: + constructedColumn = this.getName(); + break; + case 3: + constructedColumn = this.getName(); + break; + default: + if (this.getDataType() !== null && this.getDataType() !== undefined) { + if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "STRING")) + this.setDataType("text"); + } + constructDataType = (this.getDataType() !== null && this + .getDataType() !== undefined) ? "CAST (" + tableName + "." + + this.getName() + " AS " + this.getDataType() + ")" + : tableName + "." + this.getName(); + constructAlias = (this.getAlias() !== null && this.getAlias() !== undefined) ? " AS " + + this.getAlias() + : ""; + constructAggregation = (this.getAggregation() === kony.sdk.constants.Aggregation.NONE || (this + .getAggregation() === null || this.getAggregation() === undefined)) ? constructDataType + : (this.isComputedField()? this.getAggregation() : this.getAggregation() + "(" + constructDataType + ")" ) ; + constructedColumn = constructAggregation + constructAlias; + break; + } + return constructedColumn; + }; + this.toString = function() { + // To be removed later from here + if (this.getDataType() !== null && this.getDataType() !== undefined) { + if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "STRING")) + dataType = "text"; + } + var tableName = (this.getTable().getAlias() !== null + && this.getTable().getAlias() !== undefined && this.getTable() + .getAlias() !== "") ? this.getTable().getAlias() : this + .getTable().getName(); + var constructedColumn = null; + var constructDataType = null; + var constructAggregation = null; + if (this.getDataType() !== null && this.getDataType() !== undefined) { + if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "Integer")) { + constructDataType = "CAST (" + tableName + "." + this.getName() + + " AS INTEGER)"; + } else if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "Numeric")) { + constructDataType = "CAST (" + tableName + "." + this.getName() + + " AS NUMERIC)"; + } else if (kony.sdk.util.matchIgnoreCase(this.getDataType(), "Date")) { + constructDataType = "date(" + tableName + "." + this.getName() + + ")"; + } else { + if(!this.isComputedField()) + constructDataType = tableName + "." + this.getName(); + } + } else { + if(!this.isComputedField()) + constructDataType = tableName + "." + this.getName(); + } + var constructAlias = (this.getAlias() !== null + && this.getAlias() !== undefined && this.getAlias() !== "") ? " AS " + + this.getAlias() + : ""; + constructAggregation = (this.getAggregation() === kony.sdk.constants.Aggregation.NONE || (this + .getAggregation() === null || this.getAggregation() === undefined)) ? constructDataType + : (this.isComputedField()? this.getAggregation() : this.getAggregation() + "(" + constructDataType + ")" ) ; + + constructedColumn = constructAggregation + constructAlias; + return constructedColumn; + }; + + this.toStringByTablePrefix = function(includeTablePrefix) { + if (includeTablePrefix) { + return this.toString(); + } else { + return this.getName(); + } + } +}; + +kony.sdk.dto.Group = function(columnObj) { + if (columnObj instanceof kony.sdk.dto.Column) { + this.column = columnObj; + } + + this.getColumn = function() { + return this.column; + }; + this.setColumn = function(column) { + if (column instanceof kony.sdk.dto.Column) { + this.column = column; + } + }; + this.toString = function() { + var tableName = (this.column.getTable().getAlias() !== null && this.column + .getTable().getAlias() !== undefined) ? this.column.getTable() + .getAlias() : this.column.getTable().getName(); + return tableName + "." + this.column.getName(); + }; +}; + +kony.sdk.dto.Join = function() { + this.criteria; + this.table; + this.joinType; + var currentObject = this; + + if (arguments.length === 3) { + getJoinByTableCriteriaAndJoinType(arguments[0], + arguments[1], arguments[2]); + } else if (arguments.length === 4) { + getJoinByDestTableAndSrcColumnAndDestColumnAndJoinType( + arguments[0], arguments[1], arguments[2], + arguments[3]); + } + + /** + * This function is the Join constructor which has 3 arguments. + * + * @param table, + * criteria, joinType + */ + function getJoinByTableCriteriaAndJoinType(table, criteria, + joinType) { + + if (table instanceof kony.sdk.dto.Table + && kony.sdk.util.validateCriteriaObject(criteria) + && joinType !== null + && joinType !== undefined + && (joinType === kony.sdk.constants.JoinType.INNER || joinType === kony.sdk.constants.JoinType.LEFT)) { + currentObject.table = table; + currentObject.joinType = joinType; + currentObject.criteria = criteria; + return currentObject; + } else { + //TODO + //throw error + } + } + + /** + * This function is the Join constructor which has 4 arguments. + * + * @param destTable, + * srcColumn, destColumn, joinTypeObj + */ + function getJoinByDestTableAndSrcColumnAndDestColumnAndJoinType( + destTable, srcColumn, destColumn, joinTypeObj) { + if (destTable instanceof kony.sdk.dto.Table + && srcColumn instanceof kony.sdk.dto.Column + && destColumn instanceof kony.sdk.dto.Column + && joinTypeObj !== null + && joinTypeObj !== undefined + && joinTypeObj !== '' + && (joinTypeObj === kony.sdk.constants.JoinType.INNER || joinTypeObj === kony.sdk.constants.JoinType.LEFT)) { + currentObject.table = destTable; + currentObject.joinType = joinTypeObj; + var criteria = new kony.sdk.dto.Match(srcColumn, kony.sdk.constants.MatchType.EQUALS, + destColumn); + currentObject.criteria = criteria; + return currentObject; + } else { + //TODO + //throw error + } + } + + this.getCriteria = function() { + return this.criteria; + }; + + this.setCriteria = function(criteria) { + if (kony.sdk.util.validateCriteriaObject(criteria)) { + this.criteria = criteria; + } + }; + this.getTable = function() { + return this.table; + }; + + this.setTable = function(table) { + if (table instanceof kony.sdk.dto.Table) { + this.table = table; + } + }; + this.getJoinType = function() { + return this.joinType; + }; + + this.setJoinType = function(joinType) { + if (joinType !== null) { + this.joinType = joinType; + } + }; + + this.initCriteria = function(srcColumn, destColumn) { + + if ((srcColumn instanceof kony.sdk.dto.Column) + && (destColumn instanceof kony.sdk.dto.Column)) { + var criteria = new kony.sdk.dto.Match(srcColumn, kony.sdk.constants.MatchType.EQUALS, + destColumn); + this.setCriteria(criteria); + } else { + //TODO + //throw error + } + }; + + this.toString = function() { + var returnString = null; + var temp = null; + var join; + if (kony.sdk.constants.JoinType.INNER == this.getJoinType()) { + join = "INNER"; + } else if (kony.sdk.constants.JoinType.LEFT == this.getJoinType()) { + join = "LEFT"; + } else if (kony.sdk.constants.JoinType.RIGHT == this.getJoinType()) { + join = "RIGHT"; + } + returnString = " " + join + " JOIN " + + this.getTable().toString() + " ON "; + temp = this.getCriteria().toString(); + returnString = returnString + temp; + return returnString; + }; +}; + + +/** + * This function is the Order constructor. + * + * @package com.kony.common.DataAccess.Query + * @param columnObj,orderTypeObj + */ +kony.sdk.dto.Order = function(columnObj, orderTypeObj) { + if ((columnObj instanceof kony.sdk.dto.Column) + && (orderTypeObj == kony.sdk.constants.OrderType.ASCENDING || orderTypeObj == kony.sdk.constants.OrderType.DESCENDING)) { + this.column = columnObj; + this.type = orderTypeObj; + return this; + } else { + //TODO + //throw error + } + + this.getColumn = function() { + return this.column; + }; + + /** + * This function is used to set column. + * + * @param column + */ + this.setColumn = function(column) { + if (column instanceof kony.sdk.dto.Column) { + this.column = column; + } else { + //TODO + //throw error + } + + }; + this.getType = function() { + return this.type; + }; + + /** + * This function is used to set type. + * + * @param type + */ + this.setType = function(type) { + this.type = type; + }; + + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + return this.column.toString() + " " + (this.type); + }; +}; + +kony.sdk.dto.Between = function(columnObj, colRange) { + this.column; + this.range; + + if (columnObj instanceof kony.sdk.dto.Column + && (colRange instanceof kony.sdk.dto.DateRange + || colRange instanceof kony.sdk.dto.StringRange + || colRange instanceof kony.sdk.dto.IntegerRange || colRange instanceof kony.sdk.dto.FloatRange)) { + this.column = columnObj; + this.range = colRange; + } else { + //TODO + //throw error + } + + + this.quote = function(str) { + if (kony.sdk.util.isNull(str)) { + return "null"; + } + // var str1 = new String(str); + var strBuf = []; + strBuf.push('\''); + for ( var index = 0; index < str.length; index++) { + var charItem = str.charAt(index); + if (charItem == '\\' || charItem == '\"' + || charItem == '\'') { + // strBuf.concat('\\'); + strBuf.push('\\'); + } + strBuf.push(charItem); + } + strBuf.push('\''); + return strBuf.join(""); + }; + + this.setColumn = function(column) { + if (column instanceof kony.sdk.dto.Column) { + this.column = column; + } else { + //TODO + //throw error + } + }; + + this.setRange = function(range) { + if (range instanceof kony.sdk.dto.DateRange || range instanceof kony.sdk.dto.StringRange + || range instanceof kony.sdk.dto.IntegerRange + || range instanceof kony.sdk.dto.FloatRange) { + this.range = range; + } else { + //TODO + //throw error + } + }; + this.getColumn = function() { + return this.column; + }; + this.getRange = function() { + return this.range; + }; + this.toString = function() { + var returnStr = ""; + returnStr = this.getColumn().toString() + " Between " + + this.getRange().toString(); + return returnStr; + }; +}; + +/** + * This function is the DateRange constructor. + * + * @package Range + * @param startDate, + * endDate + */ +kony.sdk.dto.DateRange = function() { + this.end; + this.start; + if (arguments.length === 2) { + var startDate = arguments[0]; + var endDate = arguments[1]; + if (startDate instanceof Date && endDate instanceof Date) { + this.start = startDate; + this.end = endDate; + } else { + //TODO + //throw error + } + } else if (arguments.length === 1) { + var dateType = arguments[0]; + if (kony.sdk.util.validateDateTypeInput(dateType)) { + var range = kony.sdk.util.getDateRange(dateType); + if (range.length !== 2 || range[0] === 0 || range[1] === 0) { + //TODO + //throw error + } else { + this.start = range[0]; + this.end = range[1]; + } + } + } + + this.getEnd = function() { + return this.end; + }; + + /** + * This function is used to set End value. + * + * @param end + */ + this.setEnd = function(end) { + if (end instanceof Date) { + var month = end.getMonth() + 1; + var date = end.getDate(); + var hr = end.getHours(); + var min = end.getMinutes(); + var sec = end.getSeconds(); + if (month < 10) { + month = "0" + month; + } + if (date < 10) { + date = "0" + date; + } + if (hr < 10) { + hr = "0" + hr; + } + if (min < 10) { + min = "0" + min; + } + if (sec < 10) { + sec = "0" + sec; + } + var endDate = end.getFullYear() + "-" + month + "-" + date + " " + + hr + ":" + min + ":" + sec; + this.end = endDate; + } else { + //TODO + //throw error + } + }; + + this.getStart = function() { + return this.start; + }; + + /** + * This function is used to set start value. + * + * @param start + */ + this.setStart = function(start) { + if (start instanceof Date) { + var month = start.getMonth() + 1; + var date = start.getDate(); + var hr = start.getHours(); + var min = start.getMinutes(); + var sec = start.getSeconds(); + if (month < 10) { + month = "0" + month; + } + if (date < 10) { + date = "0" + date; + } + if (hr < 10) { + hr = "0" + hr; + } + if (min < 10) { + min = "0" + min; + } + if (sec < 10) { + sec = "0" + sec; + } + var startDate = start.getFullYear() + "-" + month + "-" + date + + " " + hr + ":" + min + ":" + sec; + this.start = startDate; + } else { + //TODO + //throw error + } + }; + + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + var returnString = null; + returnString = "'" + this.start + "'" + " AND " + "'" + this.end + "'"; + return returnString; + }; +}; + +/** + * This function is the DecimalRange constructor. + * + * @package Range + * @param startDecimal, + * endDecimal + */ +kony.sdk.dto.DecimalRange = function(startDecimal, endDecimal) { + if ((endDecimal !== null && endDecimal !== undefined && typeof endDecimal === 'number') + && (startDecimal !== null && startDecimal !== undefined && typeof startDecimal === 'number')) { + this.end = endDecimal; + this.start = startDecimal; + } else { + //TODO + //throw error + } + + + this.getEnd = function() { + return this.end; + }; + + /** + * This function is used to set End value. + * + * @param end + */ + this.setEnd = function(end) { + if (end !== null && end !== undefined && typeof end === 'number') { + this.end = end; + } else { + //TODO + //throw error + } + }; + + this.getStart = function() { + return this.start; + }; + + /** + * This function is used to set start value. + * + * @param start + */ + this.setStart = function(start) { + if (start !== null && start !== undefined && typeof start === 'number') { + this.start = start; + } else { + //TODO + //throw error + } + }; + + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + var returnString = null; + returnString = this.start + " AND " + this.end; + return returnString; + }; +}; + +/** + * This function is the FloatRange constructor. + * + * @package Range + * @param startFloat, + * endFloat + */ +kony.sdk.dto.FloatRange = function(startFloat, endFloat) { + this.end = endFloat; + this.start = startFloat; + + this.getEnd = function() { + return this.end; + }; + + /** + * This function is used to set End value. + * + * @param end + */ + this.setEnd = function(end) { + if (end !== null && end !== undefined && typeof end === 'number') { + this.end = end; + } else { + //TODO + //throw error + } + }; + + this.getStart = function() { + return this.start; + }; + + /** + * This function is used to set start value. + * + * @param start + */ + this.setStart = function(start) { + if (start !== null && start !== undefined && typeof start === 'number') { + this.start = start; + } else { + //TODO + //throw error + } + }; + + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + var returnString = null; + returnString = this.start + " AND " + this.end; + return returnString; + }; +}; + +/** + * This function is the IntegerRange constructor. + * + * @package Range + * @param startInt, + * endInt + */ +kony.sdk.dto.IntegerRange = function(startInt, endInt) { + if ((endInt !== null && endInt !== undefined && typeof endInt === 'number') + && (startInt !== null && startInt !== undefined && typeof startInt === 'number')) { + this.end = endInt; + this.start = startInt; + + } else { + //TODO + //throw error + } + + + this.getEnd = function() { + return this.end; + }; + + /** + * This function is used to set End value. + * + * @param end + */ + this.setEnd = function(end) { + if (end !== null && end !== undefined && typeof end === 'number') { + this.end = end; + } else { + //TODO + //throw error + } + }; + + this.getStart = function() { + return this.start; + }; + + /** + * This function is used to set start value. + * + * @param start + */ + this.setStart = function(start) { + if (start !== null && start !== undefined && typeof start === 'number') { + this.start = start; + } else { + //TODO + //throw error + } + }; + + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + var returnString = null; + returnString = this.start.toFixed() + " AND " + this.end.toFixed(); + return returnString; + }; +}; + +/** + * This function is the StringRange constructor. + * + * @package Range + * @param startString, + * endString + */ +kony.sdk.dto.StringRange = function(startString, endString) { + if ((endString !== null && endString !== undefined && typeof endString === 'string') + && (startString !== null && startString !== undefined && typeof startString === 'string')) { + this.end = endString; + this.start = startString; + } else { + //TODO + //throw error + } + + + this.getEnd = function() { + return this.end; + }; + + /** + * This function is used to set End value. + * + * @param end + */ + this.setEnd = function(end) { + if (end !== null && end !== undefined && typeof end === 'string') { + this.end = end; + } else { + //TODO + //throw error + } + }; + + this.getStart = function() { + return this.start; + }; + + /** + * This function is used to set start value. + * + * @param start + */ + this.setStart = function(start) { + if (start !== null && start !== undefined && typeof start === 'string') { + this.start = start; + } else { + //TODO + //throw error + } + }; + + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + var returnString = null; + var crit = new kony.sdk.dto.Criteria(); + returnString = crit.quote(this.start) + " AND " + crit.quote(this.end); + return returnString; + }; +}; + + +kony.sdk.dto.LogicGroup = function(operatorLg, leftOp, rightOp) { + this.left = leftOp; + this.operator = operatorLg; + this.right = rightOp; + + + /** + * This function is used to initialize LogicGroup. + * + * @param operator, + * left, right + */ + this.initializeLogicGroup = function(operator, left, right) { + this.left = left; + this.operator = operator; + this.right = right; + }; + + this.getLeft = function() { + return this.left; + }; + + /** + * This function is used to set left. + * + * @param val + */ + this.setLeft = function(val) { + this.val = val; + }; + this.getOperator = function() { + return this.operator; + }; + + /** + * This function is used to set Operator. + * + * @param val + */ + this.setOperator = function(val) { + this.operator = val; + }; + this.getRight = function() { + return this.right; + }; + + /** + * This function is used to set Right. + * + * @param val + */ + this.setRight = function(val) { + this.right = val; + }; + + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + var leftOperator = (this.getLeft() !== null && this.getLeft !== undefined) ? this + .getLeft().toString() + : ""; + var rightOperator = (this.getRight() !== null && this + .getRight() !== undefined) ? this.getRight().toString() + : ""; + return "(" + leftOperator + " " + this.getOperator() + " " + + rightOperator + ")"; + }; +}; + +/** + * This function is the And constructor. + * + * @param left, + * right + */ +kony.sdk.dto.And = function(left, right) { + if (arguments.length !== 2) { + //TODO + //throw error + } + if ((right !== null && left !== null && right !== undefined + && left !== undefined + && kony.sdk.util.validateCriteriaObject(left) && kony.sdk.util.validateCriteriaObject(right))) { + kony.sdk.dto.LogicGroup.call(this, 'AND', left, right); + } else { + //TODO + //throw error + } + + + this.initializeAnd = function(left, right) { + kony.sdk.dto.LogicGroup.call(this, 'AND', left, right); + }; +}; + +/** + * This function is used to initialize And. + * + * @param left, + * right + */ + +/** + * This function is the Or constructor. + * + * @param left, + * right + */ +kony.sdk.dto.Or = function(left, right) { + if (arguments.length !== 2) { + //TODO + //throw error + } + if ((right !== null && left !== null && right !== undefined + && left !== undefined + && kony.sdk.util.validateCriteriaObject(left) && kony.sdk.util.validateCriteriaObject(right))) { + kony.sdk.dto.LogicGroup.call(this, 'OR', left, right); + } else { + //TODO + //throw error + } + + this.initializeOr = function(left, right) { + kony.sdk.dto.LogicGroup.call(this, 'OR', left, right); + }; +}; + +/** + * This function is the Not constructor. + * + * @param right + */ +kony.sdk.dto.Not = function(right) { + if (arguments.length !== 1) { + //TODO + //throw error + } + if (right !== null && right !== undefined + && kony.sdk.util.validateCriteriaObject(right)) { + kony.sdk.dto.LogicGroup.call(this, 'NOT', null, right); + } else { + //TODO + //throw error + } + + + this.initializeNot = function(right) { + kony.sdk.dto.LogicGroup.call(this, 'NOT', null, right); + }; +}; + +kony.sdk.dto.Expression = function() { + this.term; + this.operator; + this.expression; + var currentExpObj = this; + if (arguments.length === 1) { + if (kony.sdk.util.validateCriteriaObject(arguments[0])) { + setTerm(arguments[0]); + } else { + //TODO + //throw error + } + } else if (arguments.length === 2) { + initExpression(arguments[0], arguments[1]); + } else if (arguments.length === 3) { + initExpressionByExpression(arguments[0], arguments[1], + arguments[2]); + } else { + //TODO + //throw error + } + + /** + * Recursively generates a Expression from a given list of + * criteria and an infix operator to join each criteria with the + * next in the list. Operator AND or Operator OR that joins each + * criteria term with the next in the list. + * + * @param criterias + * the list of criteria terms from which the + * constructor generates the new criteria expression. + * @param operator + * the infix operator + */ + function initExpression(criterias, operator) { + if (operator === kony.sdk.constants.Operator.OR) { + setOperator(kony.sdk.constants.Operator.OR); + } else if (operator === kony.sdk.constants.Operator.AND) { + setOperator(kony.sdk.constants.Operator.AND); + } else { + //TODO + //throw error + } + if (criterias !== null && criterias !== undefined + && criterias instanceof Array + && criterias.length > 0) { + if (kony.sdk.util.validateCriteriaObject(criterias[0])) { + setTerm(criterias[0]); + } + if (criterias.length > 1) { + var tmpOperator = operator; + criterias.shift(); + setExpression(new kony.sdk.dto.Expression(criterias, tmpOperator)); + } + } else { + if (kony.sdk.util.validateCriteriaObject(criterias)) { + setTerm(criterias); + // return currentExpObj; + } else { + //TODO + //throw error + } + } + } + + function setExpression(expression) { + if (expression instanceof kony.sdk.dto.Expression) { + currentExpObj.expression = expression; + // return currentExpObj; + } else { + //TODO + //throw error + } + } + + function setTerm(term) { + if (kony.sdk.util.validateCriteriaObject(term)) { + currentExpObj.term = term; + // return currentExpObj; + } else { + //TODO + //throw error + } + } + + /** + * Initializes a Expression with an initial criteria term, an + * operator, and a another trailing criteria expression. + * + * @param criterias + * the starting criteria to assign to the new + * criteria expression. + * @param operator + * the infix operator + * @param expression + * the trailing expression to assign to the new + * criteria expression. + */ + function initExpressionByExpression(criterias, operator, + expression) { + if (operator === kony.sdk.constants.Operator.OR) { + initExpression(criterias, kony.sdk.constants.Operator.OR); + } else if (operator === kony.sdk.constants.Operator.AND) { + initExpression(criterias, kony.sdk.constants.Operator.AND); + } else { + //TODO + //throw error + } + + setExpression(expression); + // return currentExpObj; + } + function setOperator(operator) { + currentExpObj.operator = operator; + } + + + this.getTerm = function() { + return this.term; + }; + this.getOperator = function() { + return this.operator; + }; + this.getExpression = function() { + return this.expression; + }; + this.toString = function() { + var returnString = null; + if ((this.getTerm() === null || this.getTerm() === undefined) + && (this.getExpression() === null || this.getExpression() === undefined)) { + returnString = ""; + } else if (this.getExpression() === null + || this.getExpression() === undefined) { + returnString = this.getTerm().toString(); + } else if (this.getOperator() === kony.sdk.constants.Operator.AND) { + returnString = (new kony.sdk.dto.And(this.getTerm(), this + .getExpression())).toString(); + } else if (this.getOperator() === kony.sdk.constants.Operator.OR) { + returnString = (new kony.sdk.dto.Or(this.getTerm(), this.getExpression())) + .toString(); + } + return returnString; + } + +}; + +kony.sdk.dto.InCriteria = function() { + this.column; + this.values; + var currentInCriteriaObj = this; + + if (arguments.length === 2) { + getInCriteriaByColumnAndCollection(arguments[0], + arguments[1]); + } else if (arguments.length === 3) { + getInCriteriaByTableAndCollection(arguments[0], + arguments[1], arguments[2]); + } else { + //TODO + //throw error + } + + /** + * This function is the InCriteria constructor which has 3 + * arguments. + * + * @param table,columnname,values + */ + function getInCriteriaByTableAndCollection(table, columnname, + values) { + if (table instanceof kony.sdk.dto.Table) { + currentInCriteriaObj.column = new kony.sdk.dto.Column(table, columnname); + currentInCriteriaObj.values = values; + + return currentInCriteriaObj; + } else { + //TODO + //throw error + } + } + + /** + * This function is the InCriteria constructor which has 2 + * arguments. + * + * @param column,values + */ + function getInCriteriaByColumnAndCollection(column, values) { + if (column instanceof kony.sdk.dto.Column && values instanceof Array + && values.length > 0) { + currentInCriteriaObj.column = column; + currentInCriteriaObj.values = values; + + return currentInCriteriaObj; + } else { + //TODO + //throw error + } + } + + + this.getColumnForTable = function(table, columnName) { + if (table instanceof kony.sdk.dto.Table) { + var column = new kony.sdk.dto.Column(table, columnName); + return column; + } else { + //TODO + //throw error + } + }; + this.getColumn = function() { + return this.column; + }; + this.setColumn = function(column) { + if (column instanceof kony.sdk.dto.Column) { + this.column = column; + } + }; + this.setValues = function(valuesCollection) { + this.values = valuesCollection; + + }; + this.getValues = function() { + return this.values; + }; + + this.toString = function() { + var result = ""; + result = this.column.toString() + " IN ("; + if (this.values !== null && this.values !== undefined + && this.values.length > 0) { + for ( var index = 0; index < this.values.length; index++) { + var value; + var criteria = new kony.sdk.dto.Criteria(); + if (typeof (this.values[index]) === "string") { + value = criteria.quote(this.values[index]); + } else { + value = this.values[index]; + } + result = result + value; + if (index !== (this.values.length - 1)) { + result = result + ", "; + } + } + } + /* + * else if (this.subSelect !== null && this.subSelect !== + * undefined) { result = result + this.subSelect; } + */ + result = result + ")"; + return result; + }; +}; + +kony.sdk.dto.Exists = function(subSelectQuery) { + if (subSelectQuery instanceof kony.sdk.dto.SelectQuery) { + this.subSelect = subSelectQuery; + } else { + //TODO + //throw error + } + + this.getSubSelect = function() { + return this.subSelect; + }; + this.setSubSelect = function(subSelect) { + + if (subSelect instanceof kony.sdk.dto.SelectQuery) { + this.subSelect = subSelect; + } else { + //TODO + //throw error + } + }; + this.toString = function() { + return "EXISTS ( " + this.subSelect.toString() + " )"; + }; +}; + +kony.sdk.dto.Criteria = function() { + + this.quote = function(str) { + + if (str === null || str === undefined) { + return "null"; + } + // var str1 = new String(str); + var strBuf = []; + strBuf.push('\''); + for ( var index = 0; index < str.length; index++) { + var charItem = str.charAt(index); + if (charItem == '\\' || charItem == '\"' || charItem == '\'') { + // strBuf.concat('\\'); + strBuf.push('\\'); + } + strBuf.push(charItem); + } + strBuf.push('\''); + return strBuf.join(""); + }; +}; + +kony.sdk.dto.Match = function() { + this.column; + this.matchType; + this.value; + var currentMatchObj = this; + + if (arguments.length === 3) { + initMatchByColumn(arguments[0], arguments[1], arguments[2]); + } else if (arguments.length === 4) { + initMatchByTableAndColName(arguments[0], arguments[1], + arguments[2], arguments[3]); + } else { + //TODO + //throw error + } + + /** + * This function is the Match constructor which has 3 arguments. + * + * @param columnObj, + * matchType, value + */ + function initMatchByColumn(columnObj, matchType, value) { + if (columnObj instanceof kony.sdk.dto.Column) { + currentMatchObj.column = columnObj; + if (matchType !== kony.sdk.constants.MatchType.EQUALS + && matchType !== kony.sdk.constants.MatchType.GREATER + && matchType !== kony.sdk.constants.MatchType.GREATEREQUAL + && matchType !== kony.sdk.constants.MatchType.LESS + && matchType !== kony.sdk.constants.MatchType.LESSEQUAL + && matchType !== kony.sdk.constants.MatchType.STARTSWITH + && matchType !== kony.sdk.constants.MatchType.CONTAINS + && matchType !== kony.sdk.constants.MatchType.LIKE + && matchType !== kony.sdk.constants.MatchType.ENDSWITH + && matchType !== kony.sdk.constants.MatchType.NOTEQUAL + && matchType !== kony.sdk.constants.MatchType.ISNULL + && matchType !== kony.sdk.constants.MatchType.ISNOTNULL) { + + //TODO + //throw error + } else { + if (matchType !== kony.sdk.constants.MatchType.ISNULL + && matchType !== kony.sdk.constants.MatchType.ISNOTNULL) { + // check if the value is passed or not except + // for NULL and NOT NULL cases. + if (value !== null && value !== undefined) { + if (value instanceof Array + && value.length <= 0) { + //TODO + //throw error + } + currentMatchObj.value = value; + } else { + //TODO + //throw error + } + } + currentMatchObj.matchType = matchType; + return currentMatchObj; + } + } else { + //TODO + //throw error + } + } + + /** + * This function is the Match constructor which has 4 arguments. + * + * @param tableObj, + * columnName, matchType, value + */ + function initMatchByTableAndColName(tableObj, columnName, + matchType, value) { + // check for validity of tableObj + if (tableObj instanceof kony.sdk.dto.Table) { + // columnName should not empty or null or undefined. + if (columnName !== null && columnName !== undefined + && typeof (columnName) === 'string' + && columnName.trim().length > 0) { + currentMatchObj.column = tableObj + .getColumn(columnName); + if (matchType !== kony.sdk.constants.MatchType.EQUALS + && matchType !== kony.sdk.constants.MatchType.GREATER + && matchType !== kony.sdk.constants.MatchType.GREATEREQUAL + && matchType !== kony.sdk.constants.MatchType.LESS + && matchType !== kony.sdk.constants.MatchType.LESSEQUAL + && matchType !== kony.sdk.constants.MatchType.STARTSWITH + && matchType !== kony.sdk.constants.MatchType.CONTAINS + && matchType !== kony.sdk.constants.MatchType.LIKE + && matchType !== kony.sdk.constants.MatchType.ENDSWITH + && matchType !== kony.sdk.constants.MatchType.NOTEQUAL + && matchType !== kony.sdk.constants.MatchType.ISNULL + && matchType !== kony.sdk.constants.MatchType.ISNOTNULL) { + + //TODO + //throw error + } else { + if (matchType !== kony.sdk.constants.MatchType.ISNULL + && matchType !== kony.sdk.constants.MatchType.ISNOTNULL) { + // check if the value is passed or not + // except for NULL and NOT NULL cases. + if (value !== null && value !== undefined) { + currentMatchObj.value = value; + } else { + //TODO + //throw error + } + } + currentMatchObj.matchType = matchType; + } + return currentMatchObj; + } else { + //TODO + //throw error + } + } else { + //TODO + //throw error + } + } + + this.getColumn = function() { + if (this.column !== null && this.column !== undefined) { + return this.column; + } else { + //TODO + //throw error + } + }; + + this.getMatchType = function() { + if (this.matchType !== null && this.matchType !== undefined) { + return this.matchType; + } else { + //TODO + //throw error + } + }; + + /** + * This function is used to set match type. + * + * @param matchType + */ + this.setMatchType = function(matchType) { + this.matchType = matchType; + }; + + this.getValue = function() { + return this.value; + }; + + /* + * quote=function(value){ return "'"+value+"'"; } + */ + + /** + * This function is used to convert to String. + * + * @return string + */ + this.toString = function() { + if (this.matchType !== null && this.matchType !== undefined + && this.column !== null && this.column !== undefined) { + var constructedMatch = null; + var constructedValue = null; + var type = this.matchType; + var val = this.matchType.name; + + if (this.value instanceof Date) { + var dateStr = ""; + var month = this.getValue().getMonth() + 1; + var date = this.getValue().getDate(); + + if (month < 10) { + month = "0" + month; + } + + if (date < 10) { + date = "0" + date; + } + dateStr = this.getValue().getFullYear() + "-" + month + + "-" + date; + constructedMatch = "date(substr(" + + this.getColumn().toString() + ",0,11)) " + + this.getMatchType().value + "'" + dateStr + + "'"; + return constructedMatch; + } + if (typeof (this.getValue()) === 'boolean') { + if (this.getValue() === true) { + return "(" + this.getColumn().toString() + + " = 'true' OR " + + this.getColumn().toString() + " = 1)"; + } else if (this.getValue() === false) { + return "(" + this.getColumn().toString() + + " = 'false' OR " + + this.getColumn().toString() + " = 0)"; + } else { + this.value = "'" + this.value + "'"; + } + } + + constructedMatch = this.getColumn().toString() + " " + + this.getMatchType().value + " "; + if (typeof (this.getValue()) === 'string') { + constructedValue = kony.sdk.util.replaceAll(this.getValue(), + "'", ""); + if (kony.sdk.util.matchIgnoreCase(type.name, "STARTSWITH")) { + constructedValue = constructedValue + "%"; + } else if (kony.sdk.util.matchIgnoreCase(type.name, "CONTAINS")) { + constructedValue = "%" + constructedValue + "%"; + } else if (kony.sdk.util.matchIgnoreCase(type.name, "ENDSWITH")) { + constructedValue = "%" + constructedValue; + } else if (kony.sdk.util.matchIgnoreCase(type.name, "ISNULL")) { + return "(lower(" + this.getColumn().toString() + + ") = 'null' OR " + + this.getColumn().toString() + " IS NULL)"; + } else if (kony.sdk.util.matchIgnoreCase(type.name, "ISNOTNULL")) { + return "(lower(" + this.getColumn().toString() + + ") != 'null' OR " + + this.getColumn().toString() + + " IS NOT NULL)"; + } + constructedValue = new kony.sdk.dto.Criteria().quote(constructedValue); + } else { + if (kony.sdk.util.matchIgnoreCase(type.name, "ISNULL")) { + return "(lower(" + this.getColumn().toString() + + ") = 'null' OR " + + this.getColumn().toString() + " IS NULL)"; + } else if (kony.sdk.util.matchIgnoreCase(type.name, "ISNOTNULL")) { + return "(lower(" + this.getColumn().toString() + + ") != 'null' OR " + + this.getColumn().toString() + + " IS NOT NULL)"; + } + constructedValue = this.getValue().toString(); + } + if (!(kony.sdk.util.matchIgnoreCase(type.name, "ISNULL") || kony.sdk.util.matchIgnoreCase(type.name, "ISNOTNULL"))) { + constructedMatch = constructedMatch + constructedValue; + } + return constructedMatch; + } else { + //TODO + //throw error + } + } + +}; + +kony.sdk.util.getSyncDbName = function() { + return kony.sync.getDBName(); +}; + + +/* + * This is the starting method for cascade delete and should be called. + * Other methods below are helper methods. + */ +kony.sdk.util.deleteRecordCascade = function(serviceName, dataObject, successCallback, failureCallback){ + var isError = false; + var markForUpload = false; + var tbname = dataObject.getObjectName(); + var wcs = []; + var objMetadata = kony.sdk.ObjectServiceUtil.getCachedObjectMetadata(serviceName, dataObject.getObjectName()); + var dbName = kony.sdk.util.getSyncDbName(); + var srcAttributes = kony.sdk.util.getPrimarykeysFromMetadata(objMetadata); + if (srcAttributes != null && srcAttributes != undefined) { + var pkLen = Object.keys(srcAttributes).length; + for (var indx = 0; indx < pkLen; indx++) { + var pKey = Object.keys(srcAttributes)[indx]; + var pKeyValue = dataObject.getRecord()[pKey]; + if(pKeyValue == null || pKeyValue == undefined) { + //TODO + //throw error + kony.sdk.verifyAndCallClosure(failureCallback, "Primarykey details missing so unable to delete"); + return; + } + var whereClause = []; + whereClause.key = pKey; + whereClause.value = pKeyValue; + kony.table.insert(wcs,whereClause); + } + } else { + //TODO + //throw error + kony.sdk.verifyAndCallClosure(failureCallback, "Primarykey details missing so unable to delete records from:"+tbname); + return; + } + + + var dbconnection = kony.sync.getConnectionOnly(dbName, dbName, txError); + if(dbconnection != null){ + kony.sync.startTransaction(dbconnection, transactionCallback, txSuccess, txError); + } + + function txSuccess(){ + if(successCallback != null && successCallback != undefined && typeof(successCallback) == 'function'){ + var response = {}; + response.deletedRecords = 1; + kony.sdk.verifyAndCallClosure(successCallback, response); + } + } + + function txError(){ + kony.sdk.verifyAndCallClosure(failureCallback, "Delete record failed"); + } + + function genericError(){ + kony.sdk.verifyAndCallClosure(failureCallback, "Delete record failed"); + } + + function transactionCallback(tx){ + var record = kony.sync.getOriginalRow(tx, tbname, wcs, genericError); + if(record === false || record == null || record == undefined){ + //no record found + return; + } + + var deletedRows = kony.sync.remove(tx, tbname, wcs, false, true, null); + if(deletedRows === false){ + //some error occurred while deleting the record + return; + } + + var relations = objMetadata["relationshipList"]; + if(relations!=null && relations!=undefined){ + for(var i=0; i 0 && !kony.sdk.util.cascadeDeleteHelper(serviceName, tx, srcAttributes, targetAttributes, tbname, "", childTableName, true, genericError, null, record, true)) { + //Error occurred while deleting children + kony.sync.rollbackTransaction(tx); + return; + } + } + } + }else{ + //no relations available for this object + //return; + } + } +}; + +kony.sdk.util.getPrimarykeysFromMetadata = function(objMetadata) { + var tmpSrcAttributes = null; + if (objMetadata.primaryKey != null && objMetadata.primaryKey != undefined && objMetadata.primaryKey.length > 0) { + tmpSrcAttributes = {}; + var pkLen = objMetadata.primaryKey.length; + for (var indx = 0; indx < pkLen; indx++) { + var pKey = objMetadata.primaryKey[indx]; + //adding primarykey column names in srcattributes which will be useful while deleting children + tmpSrcAttributes[pKey] = pKey; + } + } + return tmpSrcAttributes; +}; +kony.sdk.util.cascadeDeleteHelper = function (serviceName, tx, srcAttributes, targetAttributes, tbname, wcs, targetObjectName, isCascade, errorcallback, markForUpload, pkRecord, isLocal) { + var wcsCascade = null; + if (pkRecord === null) { + var sqlTarget = "select "; + var sourceAttribute = ""; + var srcAttributesLength = Object.keys(srcAttributes).length; + for (var index = 0 ; index < srcAttributesLength; index++) { + var pkeyName = Object.keys(srcAttributes)[index]; + var pkeyVal = srcAttributes[pkeyName]; + sourceAttribute = sourceAttribute + pkeyVal; + if(index != srcAttributesLength.length - 1) { + sourceAttribute = sourceAttribute + "," + } + } + + sqlTarget = sqlTarget + sourceAttribute + " from " + tbname + wcs; + var resultSet = kony.sync.executeSql(tx, sqlTarget, null); + if (resultSet === false) { + return false; + } + var num_records = resultSet.rows.length; + if (num_records === 0) { + return true; + } + + wcsCascade = " where "; + for (var i = 0; i <= num_records - 1; i++) { + var record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + var targetAttributesLength = Object.keys(targetAttributes).length; + for (var index = 0; index < targetAttributesLength; index++) { + var fkeyName = Object.keys(targetAttributes)[index]; + var pkeyName = targetAttributes[fkeyName]; + wcsCascade = wcsCascade + fkeyName + " = '" + record[pkeyName] + "'"; + if (index != targetAttributesLength - 1) { + wcsCascade = wcsCascade + " and " + } + } + if (i != num_records - 1) { + wcsCascade = wcsCascade + " or "; + } + } + if (kony.sdk.util.cascadeDelete(serviceName, tx, targetObjectName, wcsCascade, errorcallback, markForUpload, isCascade, tbname, isLocal) === false) { + return false; + } + + } else { + wcsCascade = " where "; + var targetAttributesLength = Object.keys(targetAttributes).length; + for (var index = 0 ; index < targetAttributesLength; index++) { + var fkeyName = Object.keys(targetAttributes)[index]; + var pkeyName = targetAttributes[fkeyName]; + wcsCascade = wcsCascade + fkeyName + " = '" + pkRecord[pkeyName] + "'"; + if(index != targetAttributesLength - 1) { + wcsCascade = wcsCascade + " and " + } + } + + return kony.sdk.util.cascadeDelete(serviceName, tx, targetObjectName, wcsCascade, errorcallback, markForUpload, isCascade, tbname, isLocal); + } + return true; +}; + +kony.sdk.util.cascadeDelete = function(serviceName, tx, targetObjectName, wcs, errorcallback, markForUpload, isCascade, parentTable, isLocal){ + var tbname = targetObjectName; + markForUpload = kony.sync.getUploadStatus(markForUpload); + var objMetadata = kony.sdk.ObjectServiceUtil.getCachedObjectMetadata(serviceName, targetObjectName); + var tmpSrcAttributes = kony.sdk.util.getPrimarykeysFromMetadata(objMetadata); + if (tmpSrcAttributes == null || tmpSrcAttributes == undefined || tmpSrcAttributes.length == 0) { + //TODO + //throw error + kony.sdk.verifyAndCallClosure(errorcallback, "Primarykey details missing so unable to delete records from:"+tbname); + return; + } + if(isCascade){ + if(removeCascadeChildren()===false){ + return false; + } + var deleteResult = kony.sdk.util.deleteBatch(tx, tbname, wcs, isLocal,markForUpload, null); + return deleteResult.hasOwnProperty("rowsdeleted"); + }else{ + var sql = "select * from " + tbname + wcs; + var resultSet = kony.sync.executeSql(tx, sql, null); + if(resultSet===false){ + return false; + } + var num_records = resultSet.rows.length; + if(num_records === 0){ + return true; + }else{ + errorcallback(); + return false; + } + } + + function removeCascadeChildren(){ + var relations = objMetadata["relationshipList"]; + if(relations!=null && relations!=undefined){ + for(var i=0; i 0 && !kony.sdk.util.cascadeDeleteHelper(serviceName, tx, tmpSrcAttributes, tmpTargetAttributes, tbname, wcs, childTableName, true, errorcallback, markForUpload, null, isLocal)){ + return false; + } + } + } + }else{ + return false; + } + } +}; + +kony.sdk.util.deleteBatch = function (tx, tablename, wc, isLocal, markForUpload, errorCallback) { + var scopename = kony.sync.scopes.syncTableScopeDic[tablename]; + var i = null; + var record = null; + var query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + var query_compile = kony.sync.qb_compile(query); + var sql = query_compile[0] + " " + wc; + var params = query_compile[1]; + var resultSet = kony.sync.executeSql(tx, sql, params, errorCallback); + if (resultSet === false) { + return false; + } + var num_records = resultSet.rows.length; + if (isLocal === false) { + for (i = 0; i <= num_records - 1; i++) { + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + record[kony.sync.originalTableChangeTypeColumn] = kony.sync.deleteColStatus; + record[kony.sync.originalTableSyncVersionColumn] = record[kony.sync.originalTableChangeTypeColumn]; + record[kony.sync.mainTableChangeTypeColumn] = null; + record[kony.sync.mainTableSyncVersionColumn] = null; + kony.sync.insertEx(tx, tablename + kony.sync.originalTableName, record, null, false); + } + } + query = kony.sync.qb_createQuery(); + kony.sync.qb_select(query, null); + kony.sync.qb_from(query, tablename); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0] + " " + wc; + params = query_compile[1]; + var syncorder = kony.sync.getSyncOrder(scopename, tx, errorCallback); + if(syncorder === false){ + return false; + } + resultSet = kony.sync.executeSql(tx, sql, params, errorCallback); + if(resultSet === false){ + return false; + } + num_records = resultSet.rows.length; + if ((syncorder !== null)) { + for (i = 0; i < num_records; i++) { + record = kony.db.sqlResultsetRowItem(tx, resultSet, i); + //adding change replay to history tables + if (isLocal === false) { + syncorder = syncorder + 1; + record[kony.sync.historyTableReplaySequenceColumn] = syncorder; + if (markForUpload === false) { + record[kony.sync.historyTableChangeTypeColumn] = kony.sync.deleteColStatusDD; + } else { + record[kony.sync.historyTableChangeTypeColumn] = kony.sync.deleteColStatus; + } + record[kony.sync.historyTableSyncVersionColumn] = kony.sync.currentSyncScopesState[scopename]; + if(kony.sync.insertEx(tx, tablename + kony.sync.historyTableName, record, errorCallback)===false){ + return false; + } + } else { + query = kony.sync.qb_createQuery(); + kony.sync.qb_delete(query, null); + kony.sync.qb_from(query, tablename + kony.sync.originalTableName); + query_compile = kony.sync.qb_compile(query); + sql = query_compile[0] + " " + wc; + params = query_compile[1]; + if(kony.sync.executeSql(tx, sql, params, errorCallback) === false) { + return false; + } + } + } + if(kony.sync.setSyncOrder(scopename, syncorder, tx, errorCallback)===false){ + return false; + } + } + //deleting main tables + resultSet = kony.sync.removeEx(tx, tablename, wc, true, errorCallback); + if(resultSet === false){ + return false; + } + var deleteResult = {}; + deleteResult[kony.sync.numberOfRowsDeleted] = resultSet.rowsAffected; + return deleteResult; +}; + +/** + * This is a replaceAll utility function + * + * @package Utils + * @param String + * string + * @param String + * toReplace + * @param String + * replaceWith + * @return String temp + */ +kony.sdk.util.replaceAll = function(string, toReplace, replaceWith) { + var temp = string; + var index = temp.indexOf(toReplace); + while (index != -1) { + temp = temp.replace(toReplace, replaceWith); + index = temp.indexOf(toReplace); + } + return temp; +}; + +kony.sdk.util.validateDateTypeInput = function(dateType) { + return (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.TODAY) + || kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.TOMORROW) + || kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.YESTERDAY) + || kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.CURRENTWEEK) + || kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.NEXTWEEK) + || kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.LASTWEEK) + || kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.CURRENTMONTH) + || kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.NEXTMONTH) + || kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.LASTMONTH)); +}; + +kony.sdk.util.getDateRange = function(dateType) { + var result = []; + var currentDate = new Date(); + var formattedDate = new Date(currentDate.getFullYear(), currentDate + .getMonth(), currentDate.getDate(), currentDate.getHours(), + currentDate.getMinutes(), currentDate.getSeconds(), currentDate + .getMilliseconds()); + var start; + var end; + if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.TODAY)) { + end = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 23, 59, 59); + start = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 0, 0, 0); + } else if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.TOMORROW)) { + formattedDate.setDate(formattedDate.getDate() + 1); + end = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 23, 59, 59); + start = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 0, 0, 0); + } else if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.YESTERDAY)) { + formattedDate.setDate(formattedDate.getDate() - 1); + end = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 23, 59, 59); + start = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 0, 0, 0); + } else if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.CURRENTWEEK)) { + var firstDayofWeek = formattedDate.getDate() - formattedDate.getDay(); + var lastDayofWeek = firstDayofWeek + 6; + formattedDate.setDate(firstDayofWeek); + start = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 0, 0, 0); + formattedDate.setDate(lastDayofWeek); + end = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 23, 59, 59); + } else if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.LASTWEEK)) { + formattedDate.setDate(formattedDate.getDate() - 7); + var firstDayofWeek = formattedDate.getDate() - formattedDate.getDay(); + var lastDayofWeek = firstDayofWeek + 6; + formattedDate.setDate(firstDayofWeek); + start = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 0, 0, 0); + formattedDate.setDate(lastDayofWeek); + end = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 23, 59, 59); + } else if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.NEXTWEEK)) { + formattedDate.setDate(formattedDate.getDate() + 7); + var firstDayofWeek = formattedDate.getDate() - formattedDate.getDay(); + var lastDayofWeek = firstDayofWeek + 6; + formattedDate.setDate(firstDayofWeek); + start = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 0, 0, 0); + formattedDate.setDate(lastDayofWeek); + end = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + formattedDate.getDate(), 23, 59, 59); + } else if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.CURRENTMONTH)) { + start = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + 1, 0, 0, 0); + end = new Date(formattedDate.getFullYear(), + formattedDate.getMonth() + 1, 0, 23, 59, 59); + } else if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.LASTMONTH)) { + start = new Date(formattedDate.getFullYear(), + formattedDate.getMonth() - 1, 1, 0, 0, 0, 0); + end = new Date(formattedDate.getFullYear(), formattedDate.getMonth(), + 0, 23, 59, 59, 999); + } else if (kony.sdk.util.matchIgnoreCase(dateType, kony.sdk.constants.DateTimeType.NEXTMONTH)) { + start = new Date(formattedDate.getFullYear(), + formattedDate.getMonth() + 1, 1, 0, 0, 0, 0); + end = new Date(formattedDate.getFullYear(), + formattedDate.getMonth() + 2, 0, 23, 59, 59, 999); + } else { + start = 0; + end = 0; + } + result.push(start); + result.push(end); + return result; +}; + +kony.sdk.util.getPkTable = function(objMetadata, columnValues, failureCallback) { + var pkTable = {}; + var whereClause = []; + if (objMetadata.primaryKey != null && objMetadata.primaryKey != undefined) { + for (var indx = 0; indx < objMetadata.primaryKey.length; indx++) { + var pKey = objMetadata.primaryKey[indx]; + var pKeyValue = columnValues[pKey]; + if(pKeyValue == null || pKeyValue == undefined) { + //TODO change to error object + kony.sdk.verifyAndCallClosure(failureCallback, "Primarykey details missing so unable to prepare where clause"); + return; + } + + pkTable.pKey = { + "key": pKey, + "value": pKeyValue + }; + var condition = {}; + condition.key = pKey; + condition.value = pKeyValue; + whereClause.push(condition); + } + return pkTable; + } else { + //TODO change to error object + kony.sdk.verifyAndCallClosure(failureCallback, "Primarykey details missing so unable to prepare where clause"); + } +}; +/** + * Method to create the Reporting service instance with the provided service name. + * @returns {ReportingService} Reporting service instance + */ +kony.sdk.prototype.getReportingService = function() { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + return new ReportingService(this); +}; +/** + * Should not be called by the developer. + * @class + * @classdesc Reporting service instance for invoking the reporting services. + */ +function ReportingService(konyRef) { + var logger = new konyLogger(); + var url = konyRef.customReportingURL; + if (typeof(url) === 'undefined') { + throw new Exception(Errors.METRICS_FAILURE, "reporting url is undefined"); + return; + } + var networkProvider = new konyNetworkProvider(); + /** + * invoke the setUserId operation + * @param {string} userId - userId specified by user + */ + + this.setUserId = function(userId) { + konyRef.setCurrentUserId(userId); + } + + /** + * invoke the getUserId operation + */ + + this.getUserId = function(userId) { + return konyRef.getUserId(); + } + + /** + * invoke the report operation + * @param {string} reportingGroupID - reporting Group ID + * @param {object} metrics - metrics being reported + */ + this.report = function(reportingGroupID, metrics) { + if (typeof(metrics) !== "object") { + throw new Exception(Errors.METRICS_FAILURE, "Invalid type for metrics data."); + return; + } + var sessionID = kony.ds.read("konyUUID"); + var reportData = konyRef.getDataStore().getItem("konyCustomReportData"); + if (!reportData) { + reportData = new Array(); + } else { + reportData = JSON.parse(reportData); + } + + konyRef.getDataStore().removeItem("konyCustomReportData"); + + var currentData = {}; + currentData.ts = kony.sdk.formatCurrentDate(new Date().toString()); + currentData.fid = reportingGroupID; + currentData.metrics = metrics; + currentData.rsid = sessionID; + reportData.push(currentData); + //nyRef.getDataStore().setItem("konyCustomReportData",JSON.stringify(reportData)); + var payload = kony.sdk.getPayload(konyRef); + if (kony.sdk.metric) { + if (kony.sdk.metric.reportEventBufferBackupArray.length === 0) { + kony.sdk.metric.readFromDS(); + } + kony.sdk.metric.pushEventsToBufferArray(); + payload.events = kony.sdk.metric.reportEventBufferBackupArray; + } + payload.reportData = reportData; + payload.rsid = sessionID; + payload.svcid = "CaptureKonyCustomMetrics"; + // if (!kony.sdk.isJson(payload)) { + // throw new Exception(Errors.METRICS_FAILURE, "Invalid json string passed for custom metrics"); + // } + var newData = {}; + newData["konyreportingparams"] = JSON.stringify(payload); + + networkProvider.post(url, newData, { + "Content-Type": "application/x-www-form-urlencoded" + }, function(res) { + //successcallback + //konyRef.getDataStore().removeItem("konyCustomReportData"); + if (kony.sdk.metric) { + kony.sdk.metric.clearBufferEvents(); + } + logger.log("metric data successfully sent" + JSON.stringify(res)); + }, + function(res) { + + var storeData = konyRef.getDataStore().getItem("konyCustomReportData"); + if (!storeData) { + storeData = new Array(); + } else { + storeData = JSON.parse(storeData); + } + if (kony.sdk.metric) { + if (kony.sdk.metric.errorCodeMap[res.opstatus]) { + kony.sdk.metric.saveInDS(); + } + } + storeData.push(reportData); + konyRef.getDataStore().setItem("konyCustomReportData", JSON.stringify(storeData)); + + logger.log("Unable to send metric report" + JSON.stringify(res)); + }, true); + } + +} + + +//stub method +kony.sdk.initiateSession = function() { + return; +} +/** + * Method to create the sync service instance. + * @returns {SyncService} sync service instance + */ +kony.sdk.prototype.getSyncService = function() { + if (!kony.sdk.isInitialized) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + return new konySdkSyncService(this); + +} + +function konySdkSyncService(konyRef) { + var SyncProvider = konyRef.sync; + if (!SyncProvider) { + throw new Exception(Errors.SYNC_FAILURE, "invalid sync provider in serviceDoc"); + } + //mapping the sync logger to mbaassyncservice logger + this.log = sync.log; + + //generic apis + this.init = function(initSuccess, initFailure) { + sync.init(initSuccess, initFailure); + } + + this.reset = function(resetSuccess, resetFailure) { + sync.reset(resetSuccess, resetFailure); + } + + this.cancelPendingChunkRequests = function(successCallback, errorCallback) { + sync.cancelPendingChunkRequests(successCallback, errorCallback); + } + + this.stopSession = function(successCallback) { + sync.stopSession(successCallback); + } + + this.rollbackPendingLocalChanges = function(successCallback, errorCallback) { + sync.rollbackPendingLocalChanges(successCallback, errorCallback); + } + + this.getPendingAcknowledgement = function(successCallback, errorCallback) { + sync.getPendingAcknowledgement(successCallback, errorCallback); + } + + this.getPendingUpload = function(successCallback, errorCallback) { + sync.getPendingUpload(successCallback, errorCallback); + } + + this.getDeferredUpload = function(successCallback, errorCallback) { + sync.getDeferredUpload(successCallback, errorCallback); + } + + this.getAllPendingUploadInstances = function(retrieveOnlyCount, successcallback, errorcallback) { + sync.getAllPendingUploadInstances(retrieveOnlyCount, successcallback, errorcallback); + } + + this.executeSelectQuery = function(query, successcallback, errorcallback) { + sync.executeSelectQuery(query, successcallback, errorcallback); + } + + var syncServiceAppid = SyncProvider["appId"]; + var syncServiceUrl = SyncProvider["url"] + "/"; + + function genericErrorCallback(res) { + var logger = new konyLogger(); + logger.log("error occurred in refreshing claims token.. Please call login again " + JSON.stringify(res)); + alert("error occurred in refreshing claims token.. Please call login again " + JSON.stringify(res)); + } + //modified api + this.startSession = function(config) { + var errorCallback; + if (config.onsyncerror) { + errorCallback = config.onsyncerror; + } else { + errorCallback = genericErrorCallback; + } + kony.sdk.claimsRefresh(sdkStartSession, errorCallback); + + function sdkStartSession() { + config = processConfig(config); + sync.startSession(config); + } + } + + this.performUpgrade = function(config) { + var errorCallback; + if (config.onperformupgradeerror) { + errorCallback = config.onperformupgradeerror; + } else { + errorCallback = genericErrorCallback; + } + kony.sdk.claimsRefresh(sdkPerformUpgrade, errorCallback); + + function sdkPerformUpgrade() { + config = processConfig(config); + sync.performUpgrade(config); + } + } + + this.isUpgradeRequired = function(config) { + var errorCallback; + if (config.isupgraderequirederror) { + errorCallback = config.isupgraderequirederror; + } else { + errorCallback = genericErrorCallback; + } + kony.sdk.claimsRefresh(sdkIsUpgradeRequired, errorCallback); + + function sdkIsUpgradeRequired() { + config = processConfig(config); + sync.isUpgradeRequired(config); + } + + } + + function processConfig(config) { + var tempConfig = config; + tempConfig.serverurl = syncServiceUrl; + tempConfig.appid = syncServiceAppid; + tempConfig.authtoken = konyRef.currentClaimToken; + return tempConfig; + } +} +function OAuthHandler(serviceUrl, providerName, callback, type) { + var popBasic = { + id: "popUp", + skin: null, + isModal: false, + transparencyBehindThePopup: 80 + }; + var popLayout = { + containerWeight: 100, + padding: [5, 5, 5, 5], + "paddingInPixel": true + }; + var popPSP = {}; + var urlType = "/" + type + "/"; + //to do.. this is a workaround for android browser issue.. need to refactor this code + var browserSF = new kony.ui.Browser({ + "id": "browserSF", + "text": "Browser", + "isVisible": true, + "detectTelNumber": true, + "screenLevelWidget": false, + "enableZoom": false + }, { + "margin": [0, 0, 0, 0], + "marginInPixel": true, + "paddingInPixel": true, + "containerWeight": 100 + }, {}); + //browserSF.handleRequest = function(){}; + var popUp = new kony.ui.Popup(popBasic, popLayout, popPSP); + popUp.add(browserSF); + popUp.show(); + + var urlConf = { + URL: serviceUrl + urlType + "login?provider=" + providerName, + requestMethod: constants.BROWSER_REQUEST_METHOD_GET + }; + browserSF.requestURLConfig = urlConf; + browserSF.handleRequest = handleRequestCallback; + + function handleRequestCallback(browserWidget, params) { + + var originalUrl = params["originalURL"]; + if (typeof(params.queryParams) !== "undefined" && typeof(params.queryParams.code) !== "undefined") { + // make request for tokens + popUp.dismiss(); + var headers = {}; + if (type == "oauth2" || type == "saml") { + headers["Content-Type"] = "application/x-www-form-urlencoded" + } + callback(urlType + "token", { + code: decodeURIComponent(params.queryParams.code) + }, headers); + } + return false; + + } +} + +if(kony.sdk){ + kony.sdk.offline = {}; +} +//defined constants related to offline authentication. +kony.sdk.offline.isOfflineEnabled = false; +kony.sdk.constants.iterations = 1024; +kony.sdk.constants.keyLength = 256; +/** +* This Utility API to be used for the user to be able to login offline into the application. +*/ +kony.sdk.offline.loginOffline = function(successCallback,errorCallback){ + var logger = new konyLogger(); + //retrieving the temporarily stored encrypted username. + var tempUserIdBase64 = kony.store.getItem("tempUserCredentials"); + + if(tempUserIdBase64 != null && tempUserIdBase64 != undefined){ + var storedBase64 = kony.store.getItem("userCredentials"); + + if(tempUserIdBase64 == storedBase64 ){ + var authResponseStr = kony.store.getItem("authResponse"); + if(authResponseStr) + successCallback(JSON.parse(authResponseStr)); + else{ + errorCallback(kony.sdk.error.getMFcodeErrObj(kony.sdk.errorcodes.offline_auth_failed,kony.sdk.errormessages.offline_auth_failed)); + } + } + else{ + errorCallback(kony.sdk.error.getMFcodeErrObj(kony.sdk.errorcodes.offline_auth_failed,kony.sdk.errormessages.offline_auth_failed)) + } + } +} +/** +* This API is to be used to store the user login success response to the device and read it in the offline auth success scenario. +*/ +kony.sdk.offline.saveUserAuthInformation = function(authResponse){ + var logger = new konyLogger(); + kony.store.setItem("authResponse",JSON.stringify(authResponse)); + logger.log("saved auth info from the login success response"); + +} + +/** +* This api saves the temporary user credentials to the device store. This is to be called only if the app is offline auth enabled. +*/ +kony.sdk.offline.saveTempUserCredentials = function(options){ + var logger = new konyLogger(); + var op = {"algo":"SHA256","userid":options["userid"],"password":options["password"],"iterations":kony.sdk.constants.iterations,"keyLength":kony.sdk.constants.keyLength}; + var key = kony.sdk.offline.getKey(op); + var encrypteduserid = kony.crypto.encrypt("aes", key, options["userid"], {}); + + var base64userid = kony.convertToBase64(encrypteduserid); + + kony.store.setItem("tempUserCredentials",base64userid); +} +/** +* This Util method reads the temporarily stored user credentials and updates the actual store of user credentials. This should be called on successful onlnine login. +*/ +kony.sdk.offline.updateSuccessUserCredentials=function(){ + var tempUserObj = kony.store.getItem("tempUserCredentials"); + if(tempUserObj != null && tempUserObj != undefined) + kony.store.setItem("userCredentials",tempUserObj); + kony.store.removeItem("tempUserCredentials"); +} + +/** +* This API generates the PBKDF2 key by reading the options passed as argument. +*/ +kony.sdk.offline.getKey = function(options){ + var userid = options["userid"]; + var password = options["password"]; + var salt = userid+password; + var iterations = options["iterations"]; + var klen = options["keyLength"]; + var key = kony.crypto.createPBKDF2Key(options["algo"], options["password"], salt ,iterations, klen); + return key; +} +/** +* This Utility API is to enable the developer read the claims token when the device is in offline mode. +*/ +kony.sdk.offline.getClaimsToken = function(){ + + var userAuthInfoStr = kony.store.getItem("userAuthInformation"); + var userAuthInfo = JSON.parse(userAuthInfoStr); + return userAuthInfo.claims_token; + +} +/** +* This API removes the user credentials from the device store. +*/ +kony.sdk.offline.removeUserCredentials = function(){ + kony.store.removeItem("userCredentials"); + kony.store.removeItem("tempUserCredentials"); +} + +/** +* Removes the user auth information from device store. +*/ +kony.sdk.offline.removeUserAuthInformation = function(){ + kony.store.removeItem("userAuthInformation"); +} +var KNYMobileFabric = null; +var KNYMetricsService = null; +kony.setupsdks = function(initConfig, successCallBack, errorCallBack) { + + // var KNYMobileFabric = null; + // var KNYMetricsService = null; + + var getServiceDocNonMFApp = function(initConfig) { + var serviceDoc = new kony.sdk.serviceDoc(); + + serviceDoc.setAppId(initConfig.appConfig.appId); + serviceDoc.setBaseId(initConfig.appConfig.appId); + serviceDoc.setAppName(initConfig.appConfig.appName); + + serviceDoc.setReportingService(kony.sdk.constants.reportingType.session, getLicenseUrl(initConfig.appConfig)); + serviceDoc.setReportingService(kony.sdk.constants.reportingType.custom, getMetricsUrl(initConfig.appConfig)); + + return serviceDoc.toJSON(); + }; + + var getLicenseUrl = function(appConfig) { + var url = ""; + if (appConfig.isturlbase) { + url = appConfig.isturlbase + "/IST"; + } else if (appConfig.secureurl) { + url = getFromServerUrl(appConfig.secureurl, "IST"); + } else if (appConfig.url) { + url = getFromServerUrl(appConfig.url, "IST"); + } + return url; + } + + var getMetricsUrl = function(appConfig) { + var url = ""; + if (appConfig.isturlbase) { + url = appConfig.isturlbase + "/CMS"; + } else if (appConfig.secureurl) { + url = getFromServerUrl(appConfig.secureurl, "CMS"); + } else if (appConfig.url) { + url = getFromServerUrl(appConfig.url, "CMS"); + } + return url; + } + + var getFromServerUrl = function(url, path) { + // ServerURL for non-mf has /mwservlet appended after the context path. + // We need to remove it to get the base server url + //url = url.replace(/mwservlet\/*$/i, ""); + //return url + path; + var newUrl = ""; + var exactSubString = url.match(/mwservlet/i); + if (exactSubString) { + var exactSubStringLength = "mwservlet".length; + var lastSubStringIndex = url.lastIndexOf(exactSubString); + var subString = url.slice(0, lastSubStringIndex); + var index = (lastSubStringIndex + exactSubStringLength); + var subString2 = url.slice(index, url.length); + var has = /[a-zA-Z0-9]/.test(subString2); + if (!has) { + newUrl = subString; + } else { + newUrl = url; + } + } else { + newUrl = url; + } + return newUrl + path; + }; + + var konyAPMSuccessCallBack = function(metricsObject, initConfig) { + kony.print("Initializing event tracking"); + KNYMetricsService = metricsObject; + if(KNYMetricsService) { + KNYMetricsService.setEventTracking(initConfig.eventTypes); + } + + }; + + var initKNYMobileFabric = function(initConfig) { + KNYMobileFabric = new kony.sdk(); + clientParams = {}; + clientParams.aid = appConfig.appId; + clientParams.aname = appConfig.appName; + KNYMobileFabric.setClientParams(clientParams); + } + + var sdkInit = function(initConfig, successcallback, failurecallback) { + var isInvalidConfig = false; + var networkProvider = new konyNetworkProvider(); + //the serviceDoc stored on the device when the app is initialized first time, + //if the network is not available, we should read the service doc and initialize the app. + if(!kony.sdk.isNetworkAvailable() && initConfig && initConfig.appConfig){ + initConfig.appConfig.svcDocRefresh = false; + var svcDocStr = kony.store.getItem("serviceDoc"); + if(svcDocStr) + initConfig.appConfig.svcDoc = JSON.parse(svcDocStr); + else + failurecallback(kony.sdk.error.getMFcodeErrObj(kony.sdk.errorcodes.servicedoc_unavailable,kony.sdk.errormessages.servicedoc_unavailable)); + } + var refreshServiceDoc = function(){ + var networkProvider = new konyNetworkProvider(); + networkProvider.post(initConfig.serviceUrl,null, { + "X-Kony-App-Key": initConfig.appKey, + "X-Kony-App-Secret": initConfig.appSecret, + "X-HTTP-Method-Override": "GET" + }, + function(data) { + kony.store.setItem("serviceDoc",JSON.stringify(data)); + }, + function(data) { + logger.log("Refresh of serviceDoc failed:" + data); + }); + } + if (KNYMobileFabric == null) { + initKNYMobileFabric(initConfig); + } + if (initConfig && initConfig.appConfig && (getLicenseUrl(initConfig.appConfig) === "")) { + if(kony.license && kony.license.setIsLicenseUrlAvailable) { + kony.license.setIsLicenseUrlAvailable(false); + kony.sdk.isLicenseUrlAvailable = false; + } + } + if (kony.sdk.isLicenseUrlAvailable && kony.license.createSession) { + kony.license.createSession(); + } + if(!initConfig.isMFApp){ + + initWithServiceDocHelper(initConfig,successcallback,failurecallback,getServiceDocNonMFApp(initConfig)); + } + else + { + if(!initConfig.appConfig.svcDocRefresh){ + if(initConfig.appConfig.svcDoc){ + initWithServiceDocHelper(initConfig,successcallback,failurecallback,initConfig.appConfig.svcDoc); + } + else{ + isInvalidConfig = true; + } + } + if(isInvalidConfig || initConfig.appConfig.svcDocRefresh){ + var cachedServiceDoc = kony.store.getItem("serviceDoc"); + if(initConfig.appConfig.svcDocRefreshTimeSecs && !isInvalidConfig){ + if(cachedServiceDoc || initConfig.appConfig.svcDoc){ + try{ + var offlineServiceDoc = cachedServiceDoc ? JSON.parse(cachedServiceDoc) : initConfig.appConfig.svcDoc; + initWithServiceDocHelper(initConfig,successcallback,failurecallback,offlineServiceDoc); + kony.timer.schedule("serviceDocTimer",refreshServiceDoc,initConfig.appConfig.svcDocRefreshTimeSecs,true); + } + catch(err) + { + failurecallback(err); + } + } + else{ + var res = networkProvider.postSync(initConfig.serviceUrl,null, { + "X-Kony-App-Key": initConfig.appKey, + "X-Kony-App-Secret": initConfig.appSecret, + "X-HTTP-Method-Override": "GET" + }); + if(res.opstatus == 0){ + res = kony.sdk.formatSuccessResponse(res); + initWithServiceDocHelper(initConfig,successcallback,failurecallback,res); + kony.store.setItem("serviceDoc",JSON.stringify(res)); + } + else{ + failurecallback(res); + } + } + } + else{ + var res = networkProvider.postSync(initConfig.serviceUrl,null, { + "X-Kony-App-Key": initConfig.appKey, + "X-Kony-App-Secret": initConfig.appSecret, + "X-HTTP-Method-Override": "GET" + }); + if(res.opstatus == 0){ + res = kony.sdk.formatSuccessResponse(res); + initWithServiceDocHelper(initConfig,successcallback,failurecallback,res); + kony.store.setItem("serviceDoc",JSON.stringify(res)); + } + else{ + if(cachedServiceDoc || initConfig.appConfig.svcDoc){ + try{ + var offlineServiceDoc = cachedServiceDoc ? JSON.parse(cachedServiceDoc) : initConfig.appConfig.svcDoc; + initWithServiceDocHelper(initConfig,successcallback,failurecallback,offlineServiceDoc); + kony.timer.schedule("serviceDocTimer",refreshServiceDoc,initConfig.appConfig.svcDocRefreshTimeSecs,true); + } + catch(err) + { + failurecallback(err); + } + } + else{ + failurecallback(res); + } + + } + } + } + + } + + }; + + var initWithServiceDocHelper = function(initConfig,successcallback, failurecallback,serviceDoc) { + try { + KNYMobileFabric.initWithServiceDoc(initConfig.appKey,initConfig.appSecret,serviceDoc); + var MetricsService = null; + if (kony.sdk.isLicenseUrlAvailable) { + MetricsService = KNYMobileFabric.getMetricsService(); + if (kony.license.registerChangeListener) { + kony.license.registerChangeListener(KNYMobileFabric.sessionChangeHandler); + } + } + if(initConfig.isMFApp){ + konyRef.isAnonymousProvider = true ; + } + if (successcallback){ + successcallback(MetricsService, initConfig); + } + } + catch (error) { + if (failurecallback) + failurecallback(error); + } + } + + /* + * isMFApp -- boolean to indicate app is being built for MFapp as backend or plain Konyserver + * appConfig -- set to appConfig of startup.js + * + * --MF Parameters-- + * serviceUrl -- mf appconfig url + * appKey -- set to App Key for MF app scenario + * appSecret -- set to App Secret for MF app scenario + * + * -- For APM -- + * eventTypes -- This should be set to comma separated values chosen in the IDE for events chosen for automatic tracking + * + * Examples + * var sdkInitConfigForMF = { + * "isMFApp": true, + "appConfig" : appconfig, + + "appKey" :"", + "appSecret":"", + "serviceUrl" : "", + "eventTypes" : ["FormEntry","FormExit","Touch","ServiceRequest","ServiceResponse","Gesture","Orientation","Error","Crash"] + } + * var sdkInitConfigForNonMF = { + "isMFApp": false, + "appConfig" : appconfig + + "eventTypes" : ["FormEntry","FormExit","Touch","ServiceRequest","ServiceResponse","Gesture","Orientation","Error","Crash"] + } + */ + + sdkInit(initConfig, + function(metricsObject, initConfig) { + kony.print("sdk initialization done"); + konyAPMSuccessCallBack(metricsObject, initConfig); + if (successCallBack) + successCallBack(KNYMobileFabric); + }, + function(errorObj) { + kony.print("Error in setup" + errorObj ? errorObj.toString() : ""); + if (errorCallBack) + errorCallBack(errorObj); + }); + +}; + function konyLogger() { + this.log = function(text) { + if (kony.sdk.isDebugEnabled) { + kony.print(text); + } + } + } + /** + * Flag used to override the network availability api for automation testing. + * @type {boolean} + */ + overrideNetworkFlag = false; + /** + * Utility Method for the application to check the network availability. + */ + kony.sdk.isNetworkAvailable = function(){ + //Check the network flag if set for testing. This would mandate the application to be offline if device has network connectivity. + if(overrideNetworkFlag !== undefined && overrideNetworkFlag !== null && overrideNetworkFlag && overrideNetworkFlag === true) + return false; + + return kony.net.isNetworkAvailable(constants.NETWORK_TYPE_ANY); + } + /** + * Utility method to set the network flag for offline testing. + */ + kony.sdk.overrideNetworkFlag = function(){ + overrideNetworkFlag = true; + } + /** + * Utility method to reset the network flag set for offline testing. + */ + kony.sdk.resetNetworkFlag = function(){ + overrideNetworkFlag = false; + overrideNetworkFlag = undefined; + } + /* + function konyNetworkProvider() { + //var logger = new konyLogger(); + this.post = function (url, params, headers, successCallback, failureCallback, includeReportingParams) { + + function networkCallbackStatus(status, result) { + if (status === 400) { + logger.log("Response:" + JSON.stringify(result)); + if (result.opstatus !== null && result.opstatus !== undefined && result.opstatus !== 0) { + failureCallback(result); + } else { + successCallback(result); + } + } + } + if (headers === undefined || headers === null) { + headers = {} + } + if (headers["Content-Type"] === null || headers["Content-Type"] === undefined) { + //headers["Content-Type"] = "application/json"; //setting to default header + //headers["Content-Type"] = "application/x-www-form-urlencoded"; //setting to default header + } + // headers = JSON.stringify(headers); + + if (params === undefined || params === null) { + params = {}; + } + + if(typeof(headers) !== 'undefined' && headers !== null){ + params.httpheaders = headers; + } + + var sprop = "konyreportingparams"; + + if (includeReportingParams) { + + if (params[sprop]) { + //This means is this is a reporting service. The license.js will cleanup this variable. + // To ensure that our values are nto overridden we take a back up of the same. + params.konysdktemparams = params[sprop]; + if (Object.defineProperty) { + Object.defineProperty(params, sprop, { + get : function () { + return this.konysdktemparams; + }, + set : function (value) {} + }); + } else { + params.__defineGetter__(sprop, function () { + return this.konysdktemparams; + }); + params.__defineSetter__(sprop, function (value) {}); + } + } + } else { + if (Object.defineProperty) { + Object.defineProperty(params, sprop, { + get : function () {}, + set : function () {} + }); + } else { + params.__defineGetter__(sprop, function () {}); + params.__defineSetter__(sprop, function () {}); + } + } + + //#ifdef desktopweb + //To be removed:hack for desktopweb case + if(url.indexOf("?") == -1) + url = url + "?/CMS"; + else + url = url + "&/CMS"; + //#endif + logger.log("Hitting " + url + " with params " + JSON.stringify(params)); + kony.net.invokeServiceAsync(url, params, networkCallbackStatus, null); + }; + }; + */ +function konyNetworkProvider() { + this.post = function(url, params, headers, successCallback, failureCallback, konyContentType) { + if (typeof(XMLHttpRequest) !== 'undefined') { + konyXMLHttpRequestWrapper(url, params, headers, "POST", konyContentType, successCallback, failureCallback); + } else { + konyNetHttpRequest(url, params, headers, "POST", konyContentType, successCallback, failureCallback); + } + }; + //postSync will only work for Richclients like Android,IOS + this.postSync = function(url,param,headers){ + return konyNetHttpRequestSync(url,param,headers); + }; + this.get = function(url, params, headers, successCallback, failureCallback, konyContentType) { + if (typeof(XMLHttpRequest) !== 'undefined') { + konyXMLHttpRequestWrapper(url, params, headers, "GET", konyContentType, successCallback, failureCallback); + } else { + konyNetHttpRequest(url, params, headers, "GET", konyContentType, successCallback, failureCallback); + } + } +}; + +function konyXMLHttpRequestWrapper(url, params, headers, httpMethod, konyContentType, successCallback, failureCallback) { + var logger = new konyLogger(); + if (typeof(window) === 'undefined') { + logger.log("window is not defined."); + return; + } + var userAgent = window.navigator.userAgent; + var IE = userAgent.indexOf("MSIE "); + if (IE != -1 && typeof(xdomain) === "undefined") { + + function callback(xdomain) { + logger.log("xdomain is " + xdomain); + xdomain.debug = true; + var slaves = kony.sdk.getXdomainSlaves(); + xdomain.slaves(slaves); + konyXMLHttpRequest(url, params, headers, httpMethod, konyContentType, successCallback, failureCallback); + } + xdomain_init(callback); + + } else { + konyXMLHttpRequest(url, params, headers, httpMethod, konyContentType, successCallback, failureCallback); + } +}; + +function konyNetHttpRequest(url, params, headers, httpMethod, konyContentType, successCallback, failureCallback) { + var logger = new konyLogger(); + var paramsTable = null; + var httpRequest = new kony.net.HttpRequest(); + var isInvalidJSON = false; + //if httpmethod is not provided falling back to POST + if (!httpMethod) { + httpMethod = constants.HTTP_METHOD_POST; + } + + + httpRequest.open(httpMethod, url); + + function localRequestCallback(result) { + var readyState = Number(httpRequest.readyState.toString()); + var status = Number(httpRequest.status.toString()); + if (readyState === 4) { + var response = null; + if (result && result.response) { + response = result.response; + } else if (httpRequest.response) { + response = httpRequest.response; + } + if (response && typeof(response) === 'string') { + if(kony.sdk.isJson(response)){ + response = JSON.parse(response); + } + else{ + isInvalidJSON = true; + } + } + if(response && !(isInvalidJSON)){ + response.httpresponse = {}; + response.httpresponse.headers = httpRequest.getAllResponseHeaders(); + response.httpresponse.url = url; + response.httpresponse.responsecode = status; + } + if(isInvalidJSON || (!response && status == 200 )){ + var errorMessage={}; + errorMessage.httpresponse = {}; + errorMessage["opstatus"]=kony.sdk.errorcodes.invalid_json_code; + errorMessage["errmsg"]= kony.sdk.errormessages.invalid_json_message; + errorMessage["errcode"]=kony.sdk.errorcodes.invalid_json_code; + errorMessage["httpStatusCode"] = status; + errorMessage.httpresponse["response"]= response; + errorMessage.httpresponse.headers = httpRequest.getAllResponseHeaders(); + errorMessage.httpresponse.url = url; + errorMessage.httpresponse.responsecode = status; + + failureCallback(errorMessage); + } + else if (status === 200) { + if (!response.opstatus) { + response.opstatus = 0; + } + if (response.opstatus === 0) { + successCallback(response); + } else { + failureCallback(response); + } + + } else { + var resultTable = {}; + if (response) { + resultTable = response; + resultTable.httpStatusCode = httpRequest.status.toString(); + } else { + resultTable["opstatus"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errcode"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errmsg"] = kony.sdk.errormessages.connectivity_error_message; + + } + failureCallback(resultTable); + } + + } + } + if (konyContentType == undefined || konyContentType == null || konyContentType != 'formjson') { + //preparing params for other than object services + var firstKey = true; + for (var key in params) { + if (firstKey) { + paramsTable = new kony.net.FormData(); + firstKey = false; + } + if (typeof(params[key])!= "undefined") { + if(typeof(params[key]) !== "string"){ + params[key] = JSON.stringify(params[key]); + } + paramsTable.append((key), (params[key])); + } + } + } else if (konyContentType == "formjson"){ + //for specific requests like object services we will send json through form encoding machanism. + if (params) { + //for object services we have to set the data to jsondata key in the post body. + paramsTable = new kony.net.FormData(); + paramsTable.append("jsondata", JSON.stringify(params)); + } + } + if (headers) { + for (var key in headers) { + httpRequest.setRequestHeader(key, headers[key]); + } + } else { + httpRequest.setRequestHeader("Content-Type", "application/json"); + } + httpRequest.onReadyStateChange = localRequestCallback; + if (paramsTable) { + httpRequest.send(paramsTable); + } else { + httpRequest.send(); + } +} + +function konyNetHttpRequestSync(url, params, headers) { + var logger = new konyLogger(); + var paramsTable = null; + var httpRequest = new kony.net.HttpRequest(); + var isInvalidJSON = false; + httpRequest.open(constants.HTTP_METHOD_POST, url,false); + var firstKey = true; + for (var key in params) { + if (firstKey) { + paramsTable = new kony.net.FormData(); + firstKey = false; + } + if (typeof(params[key])!= "undefined") { + if(typeof(params[key]) !== "string"){ + params[key] = JSON.stringify(params[key]); + } + paramsTable.append((key), (params[key])); + } + } + + if (headers) { + for (var key in headers) { + httpRequest.setRequestHeader(key, headers[key]); + } + } else { + httpRequest.setRequestHeader("Content-Type", "application/json"); + } + //httpRequest.onReadyStateChange = localRequestCallback; + httpRequest.send(paramsTable); + var response = null; + var status = Number(httpRequest.status.toString()); + if (httpRequest.response) { + response = httpRequest.response; + } + if (response && typeof(response) === 'string') { + if(kony.sdk.isJson(response)){ + response = JSON.parse(response); + } + else{ + isInvalidJSON = true; + } + } + if(response && !(isInvalidJSON)){ + response.httpresponse = {}; + response.httpresponse.headers = httpRequest.getAllResponseHeaders(); + response.httpresponse.url = url; + response.httpresponse.responsecode = status; + } + if(isInvalidJSON || (!response && status == 200 )){ + var errorMessage={}; + errorMessage.httpresponse = {}; + errorMessage["opstatus"]=kony.sdk.errorcodes.invalid_json_code; + errorMessage["errmsg"]= kony.sdk.errormessages.invalid_json_message; + errorMessage["errcode"]=kony.sdk.errorcodes.invalid_json_code; + errorMessage["httpStatusCode"] = status; + errorMessage.httpresponse["response"]= response; + errorMessage.httpresponse.headers = httpRequest.getAllResponseHeaders(); + errorMessage.httpresponse.url = url; + errorMessage.httpresponse.responsecode = status; + + return errorMessage; + } + else if (status === 200) { + if (!response.opstatus) { + response.opstatus = 0; + } + return response; + } else { + var resultTable = {}; + if (response) { + resultTable = response; + resultTable.httpStatusCode = httpRequest.status.toString(); + } else { + resultTable["opstatus"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errcode"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errmsg"] = kony.sdk.errormessages.connectivity_error_message; + + } + return resultTable; + } +} + + +function konyXMLHttpRequest(url, params, headers, httpMethod, konyContentType, successCallback, errorCallback) { + var logger = new konyLogger(); + + var paramsTable = ""; + var firstVal = true; + var resultTable = {}; + var httpRequest = new XMLHttpRequest(); + if (typeof(errorCallback) === 'undefined') { + errorCallback = successCallback; + } + if (!params) { + params = ""; + } + + + //if httpmethod is not provided falling back to POST + if (!httpMethod) { + httpMethod = constants.HTTP_METHOD_POST; + } + + httpRequest.onerror = function(res) { + resultTable["opstatus"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errcode"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errmsg"] = kony.sdk.errormessages.connectivity_error_message; + errorCallback(resultTable); + }; + + httpRequest.onload = function (res) { + var isInvalidJSON=false; + if(res && res.target){ + if(res.target.response !== ""){ + if(kony.sdk.isJson(res.target.response)){ + resultTable = JSON.parse(res.target.response); + } + else{ + isInvalidJSON=true; + } + } + if(isInvalidJSON || (res.target.status==200 && !res.target.response)) + { + resultTable={}; + resultTable.httpresponse = {}; + resultTable["opstatus"]= kony.sdk.errorcodes.invalid_json_code; + resultTable["errmsg"]= kony.sdk.errormessages.invalid_json_message; + resultTable["errcode"]= kony.sdk.errorcodes.invalid_json_code; + resultTable["httpStatusCode"] = res.target.status; + resultTable.httpresponse["response"]= res.target.response; + resultTable.httpresponse.headers = res.target.getAllResponseHeaders(); + resultTable.httpresponse.responsecode =res.target.status; + resultTable.httpresponse.url= url; + errorCallback(resultTable); + } + else if(res.target.status === 200){ + resultTable.httpresponse = {}; + resultTable.httpresponse.headers = res.target.getAllResponseHeaders(); + resultTable.httpresponse.responsecode =res.target.status; + resultTable.httpresponse.url= url; + if(!resultTable.opstatus){ + resultTable.opstatus = 0; + } + if (resultTable["opstatus"] === 0) { + successCallback(resultTable); + } else { + errorCallback(resultTable); + } + + } + else { + if(res.target.response){ + resultTable["httpStatusCode"] = res.target.status; + resultTable.httpresponse = {}; + resultTable.httpresponse.headers = res.target.getAllResponseHeaders(); + resultTable.httpresponse.responsecode =res.target.status; + resultTable.httpresponse.url= url; + errorCallback(resultTable); + } + else + { + resultTable["opstatus"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errcode"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errmsg"] = kony.sdk.errormessages.connectivity_error_message; + errorCallback(resultTable); + } + } + } + else{ + resultTable["opstatus"] = kony.sdk.errorcodes.unknown_error_code; + resultTable["errcode"] = kony.sdk.errorcodes.unknown_error_code; + resultTable["errmsg"] = kony.sdk.errormessages.unknown_error_message; + errorCallback(resultTable); + } + }; + + httpRequest.ontimeout = function(res) { + resultTable["opstatus"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errcode"] = kony.sdk.errorcodes.connectivity_error_code; + resultTable["errmsg"] = kony.sdk.errormessages.connectivity_error_message; + errorCallback(resultTable); + } + httpRequest.open(httpMethod, url, true); + if (typeof(headers) !== 'undefined' && headers !== null) { + if (typeof(headers["Content-Type"]) === 'undefined') { + headers["Content-Type"] = "application/json"; + } + for (var header in headers) { + httpRequest.setRequestHeader(header, headers[header]); + } + } + + if (params && params.httpconfig && params.httpconfig.timeout) { + + httpRequest.timeout = params.httpconfig.timeout * 1000; + + } + if (konyContentType == undefined || konyContentType == null || konyContentType != 'formjson') { + //preparing params for other than object services + if (headers["Content-Type"] === "application/x-www-form-urlencoded" || headers["Content-Type"] === "application/json") { + var paramsTable = ""; + var firstVal = true; + for (var key in params) { + if (!firstVal) { + paramsTable += "&"; + } + firstVal = false; + if (params[key]) { + if(typeof(params[key]) === "object") + { + paramsTable = paramsTable + key + "=" + encodeURIComponent(JSON.stringify(params[key])); + } + else + { + paramsTable = paramsTable + key + "=" + encodeURIComponent(params[key]); + } + } + } + params = paramsTable; + } else if (typeof(params) !== "string") { + params = JSON.stringify(params); + } + } else if (konyContentType == "formjson"){ + //for specific requests like object services we will send json through form encoding machanism. + if (params) { + //for object services we have to set the data to jsondata key in the post body. + var tmpParams = new kony.net.FormData(); + tmpParams.append("jsondata", JSON.stringify(params)); + params = tmpParams; + } + } + try { + if (params) { + httpRequest.send(params); + } else { + httpRequest.send(); + } + + } catch (e) { + alert("error occurred " + JSON.stringify(e)); + } + +} + +function konyDataStore() { + var logger = new konyLogger(); + this.setItem = function(key, value) { + logger.log("Setting item:" + value + " with key:" + key); + if (typeof(key) !== "string") { + throw new Exception(Errors.DATA_STORE_EXCEPTION, "Invalid Key"); + } else { + try { + key = key.replace(/\//gi, ""); + kony.store.setItem(key, value); + } catch (e) { + logger.log("Failed to set item in dtastore:" + e); + } + } + }; + + this.getItem = function(key) { + logger.log("Getting item for key:" + key); + if (typeof(key) !== "string") { + throw new Exception(Errors.DATA_STORE_EXCEPTION); + } else { + key = key.replace(/\//gi, ""); + var value = kony.store.getItem(key); + if (value === null || value === undefined) { + logger.log("No value found with key:" + key); + return null; + } else { + return value; + } + } + }; + + this.removeItem = function(key) { + logger.log("Removing item for key:" + key); + if (typeof(key) !== "string") { + throw new Exception(Error.DATA_STORE_EXCEPTION); + } else { + key = key.replace(/\//gi, ""); + kony.store.removeItem(key); //If no item with that key exists, the method does not perform any action. Thus no need to check for key availablity. + } + }; + + this.destroy = function() { + logger.log("Destroying data store for this app"); + kony.store.clear(); + }; + + this.getAllItems = function() { + logger.log("Getting all item from data store"); + var items = {}; + var len = kony.store.length(); //get key length + for (var i = 0; i < len; i++) { + var key = kony.store.key(i); //get ith key + var value = kony.store.getItem(key); //get value + items[key] = value; //prepare itemset + } + return items; + } +}; + +//#ifdef iphone +//#define KONYSYNC_IOS +//#endif +//#ifdef bb +//#define KONYSYNC_BB +//#endif +//#ifdef bb10 +//#define KONYSYNC_BB10 +//#endif +//#ifdef spabb +//#define KONYSYNC_BB +//#endif +//#ifdef spabbnth +//#define KONYSYNC_BB +//#endif +//#ifdef winmobile +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef winmobile6x +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef winphone8 +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef android +//#define KONYSYNC_ANDROID +//#endif +//#ifdef j2me +//#define KONYSYNC_J2ME +//#endif + +//#ifdef ipad +//#define KONYSYNC_IOS +//#endif +//#ifdef tabrcandroid +//#define KONYSYNC_ANDROID +//#endif +//#ifdef playbook +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef spaip +//#define KONYSYNC_IOS +//#endif +//#ifdef spaipad +//#define KONYSYNC_IOS +//#endif +//#ifdef spaan +//#define KONYSYNC_ANDROID +//#endif +//#ifdef spatabandroid +//#define KONYSYNC_ANDROID +//#endif +//#ifdef spaplaybook +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef windows8 +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef spawinphone8 +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef spawindows +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef spatabwindows +//#define KONYSYNC_WINDOWS +//#endif + +//#ifdef desktop_kiosk +//#define KONYSYNC_WINDOWS +//#endif +//#ifdef desktopweb +//#define KONYSYNC_WINDOWS +//#endif + + +//#ifdef iphone +//#define KONYSYNC_MOBILE +//#endif +//#ifdef bb +//#define KONYSYNC_MOBILE +//#endif +//#ifdef bb10 +//#define KONYSYNC_MOBILE +//#endif +//#ifdef winmobile +//#define KONYSYNC_MOBILE +//#endif +//#ifdef winmobile6x +//#define KONYSYNC_MOBILE +//#endif +//#ifdef winphone8 +//#define KONYSYNC_MOBILE +//#endif +//#ifdef android +//#define KONYSYNC_MOBILE +//#endif +//#ifdef j2me +//#define KONYSYNC_MOBILE +//#endif +//#ifdef symbian +//#define KONYSYNC_MOBILE +//#endif +//#ifdef spaip +//#define KONYSYNC_MOBILE +//#endif +//#ifdef spaan +//#define KONYSYNC_MOBILE +//#endif +//#ifdef spabb +//#define KONYSYNC_MOBILE +//#endif +//#ifdef spawindows +//#define KONYSYNC_MOBILE +//#endif +//#ifdef spabbnth +//#define KONYSYNC_MOBILE +//#endif +//#ifdef spawinphone8 +//#define KONYSYNC_MOBILE +//#endif + +//#ifdef ipad +//#define KONYSYNC_TAB +//#endif +//#ifdef tabrcandroid +//#define KONYSYNC_TAB +//#endif +//#ifdef playbook +//#define KONYSYNC_TAB +//#endif +//#ifdef spaipad +//#define KONYSYNC_TAB +//#endif +//#ifdef spatabandroid +//#define KONYSYNC_TAB +//#endif +//#ifdef spaplaybook +//#define KONYSYNC_TAB +//#endif +//#ifdef windows8 +//#define KONYSYNC_TAB +//#endif +//#ifdef spatabwindows +//#define KONYSYNC_TAB +//#endif + +//#ifdef desktop_kiosk +//#define KONYSYNC_DESKTOP +//#endif +//#ifdef desktopweb +//#define KONYSYNC_DESKTOP +//#endif + +kony.sdk.getSdkType = function() { + return "js"; +} + +kony.sdk.getPayload = function(konyRef) { + var payload = {}; + payload.os = kony.os.deviceInfo().version + ""; + payload.dm = kony.os.deviceInfo().model; + payload.did = kony.sdk.getDeviceId(kony.os.deviceInfo().name); + payload.ua = kony.os.userAgent(); + var clientParams = konyRef.getClientParams(); + payload.aid = clientParams.aid ? clientParams.aid : konyRef.mainRef.baseId; + payload.aname = clientParams.aname ? clientParams.aname : konyRef.mainRef.name; + payload.chnl = kony.sdk.getChannelType(); + payload.plat = kony.sdk.getPlatformName(); + if(payload.plat === "ios" && kony.os.deviceInfo().name !== "thinclient") { + payload.did = getDeviceIdForIOSPlatform(); + } + payload.aver = appConfig.appVersion; + payload.atype = "native"; + payload.stype = "b2c"; + payload.kuid = konyRef.getUserId(); + payload.mfaid = konyRef.mainRef.appId; + payload.mfbaseid = konyRef.mainRef.baseId; + payload.mfaname = konyRef.mainRef.name; + payload.sdkversion = kony.sdk.version; + payload.sdktype = kony.sdk.getSdkType(); + + return payload; +} +kony.sdk.getDeviceId = function(name) { + if (name === "thinclient") { + var deviceID = kony.ds.read("deviceID"); + if (!deviceID) { + deviceID = kony.license.generateUUID().toString(); + kony.ds.save(deviceID, "deviceID"); + } + return deviceID; + } else { + return kony.os.deviceInfo().deviceid; + } + +} +kony.sdk.getChannelType = function() { + var returnVal = ""; + //#ifdef KONYSYNC_MOBILE + returnVal = "mobile"; + //#endif + //#ifdef KONYSYNC_TAB + returnVal = "tablet"; + //#endif + //#ifdef KONYSYNC_DESKTOP + returnVal = "desktop"; + //#endif + return returnVal; +}; + +kony.sdk.getPlatformName = function() { + var returnVal = ""; + //#ifdef KONYSYNC_IOS + returnVal = "ios"; + //#endif + //#ifdef KONYSYNC_WINDOWS + returnVal = "windows"; + //#endif + //#ifdef KONYSYNC_ANDROID + returnVal = "android"; + //#endif + //#ifdef KONYSYNC_J2ME + returnVal = "j2me"; + //#endif + //#ifdef KONYSYNC_BB + returnVal = "blackberry"; + //#endif + return returnVal; +}; + +kony.mbaas.invokeMbaasServiceFromKonyStudio = function(url, inputParam, serviceID, operationID, callBack) { + var currentInstance = kony.sdk.getCurrentInstance(); + if (!currentInstance) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + var integrationService = currentInstance.getIntegrationService(serviceID); + + var headers = null; + if (inputParam && inputParam["httpheaders"]) { + headers = inputParam["httpheaders"]; + delete inputParam["httpheaders"]; + } + + integrationService.invokeOperation(operationID, headers, inputParam, function(res) { + if (typeof(callBack) === 'function') { + callBack(400, res); + } + + }, function(res) { + if (typeof(callBack) === 'function') { + callBack(400, res); + } + }); +} +kony.mbaas.invokeMbaasServiceFromKonyStudioSync = function(url,inputParam, serviceID, operationID) { + var currentInstance = kony.sdk.getCurrentInstance(); + if (!currentInstance) { + throw new Exception(Errors.INIT_FAILURE, "Please call init before invoking this service"); + } + var integrationService = currentInstance.getIntegrationService(serviceID); + + var headers = null; + if (inputParam && inputParam["httpheaders"]) { + headers = inputParam["httpheaders"]; + delete inputParam["httpheaders"]; + } + + return integrationService.invokeOperationSync(operationID, headers, inputParam); +} +kony.mbaas.invokeMbaasServiceFromKonyStudioAsync = function(url,inputParam, serviceID, operationID,callBack) { + kony.mbaas.invokeMbaasServiceFromKonyStudio(url,inputParam, serviceID, operationID,callBack); +} +kony.sdk.XdomainSlaves = {}; + +kony.sdk.XdomainLibPath = null; + +kony.sdk.getXdomainSlaves = function() { + function isEmptyObject(obj) { + for (var name in obj) { + return false; + } + return true; + } + if (isEmptyObject(kony.sdk.XdomainSlaves)) { + throw new Exception(Errors.MISC_FAILURE, "No XdomainSlaves defined. Please use the kony.sdk.setXdomainSlaves({'http://authtenant.konycloud.com':'xdomain'}) to set the Xdomain slaves"); + } + return kony.sdk.XdomainSlaves; +}; + +kony.sdk.setXdomainSlaves = function(slaveEndPointMap) { + if (!slaveEndPointMap) { + throw new Exception(Errors.MISC_FAILURE, "Invalid slave end points"); + } + for (var key in slaveEndPointMap) { + kony.sdk.XdomainSlaves[key] = slaveEndPointMap[key]; + } +} + +kony.sdk.getXdomainLibPath = function() { + return kony.sdk.XdomainLibPath; +} + +kony.sdk.setXdomainLibPath = function(path) { + if (!path) { + throw new Exception(Errors.MISC_FAILURE, "Invalid path"); + } + kony.sdk.XdomainLibPath = path; +} + +function xdomain_init(callback) { + var logger = new konyLogger(); + + jQuery.getScript(kony.sdk.getXdomainLibPath()).done(function() { + if (typeof(xdomain) !== 'undefined') { + logger.log("xdomain Script loading done"); + callback(xdomain); + } else { + throw new Exception(Errors.MISC_FAILURE, "not able to fetch xdomain library from " + kony.sdk.getXdomainLibPath()); + } + + }).fail(function() { + //TODO: handle failure case + throw new Exception(Errors.MISC_FAILURE, "xdomain library load failed from " + kony.sdk.getXdomainLibPath()); + }); +} + +function getDeviceIdForIOSPlatform() { + if(kony.os.deviceInfo().osversion >= 6.0) { + return kony.os.deviceInfo().identifierForVendor; + } + return kony.os.deviceInfo().customdeviceid; +} + diff --git a/SegementAnimation/modules/konylibrary.js b/SegementAnimation/modules/konylibrary.js new file mode 100644 index 0000000..e228e37 --- /dev/null +++ b/SegementAnimation/modules/konylibrary.js @@ -0,0 +1,1920 @@ + + kony.decrement = function(num){ + if(typeof(num) === "number"){ + return num - 1; + }else{ + return num; + } + }; + + kony.increment = function(num){ + if(typeof(num) === "number"){ + return num + 1; + }else{ + return num; + } + }; + + kony.decrementIndices = function(arr){ + var tArr = []; + for(var i=0; i < arr.length; i++) { + tArr[i] = arr[i] - 1; + } + return tArr; + }; + + kony.incrementIndices = function(arr){ + var tArr = []; + for(var i=0; i < arr.length; i++) { + tArr[i] = arr[i] + 1; + } + return tArr; + }; +/**The Math Library has APIs that you can use to perform mathematical operations.*/ +kony.math = { + /**@Deprecated. This API returns the value of pi. Note: math.pi is not a function, but a property in math namespace.*/ + pi: Math.PI, + + /**@Deprecated. This API generates pseudo-random numbers which are uniformly distributed. This API generates a real number between 0 and 1.*/ + random: function () { + + return (Math.random()); + /*var result = Math.random(); + + if (0 === args.length) { + return result; + } else if (1 === args.length) { + args[0] -= 0; + if (isNaN(args[0])) { + throw new Error("Invalid argument to math.random"); + } + + result = Math.floor(result * args[0]) + 1; + } else if (2 === args.length) { + args[0] -= 0; args[1] -= 0; + if (isNaN(args[0]) || isNaN(args[1])) { + throw new Error("Invalid argument(s) to math.random"); + } + + result = Math.floor(result * (args[1] - args[0] + 1)) + args[0]; + } else { + throw new Error("Invalid number of arguments to math.random"); + } + + return result;*/ + }, + + /* + randomseed: function (args) { + return null; + }, + */ +/**@Deprecated. This API sets the input parameter as the "seed" for the pseudo-random generator. +Note: Equal seeds produce equal sequences of numbers.*/ + randomSeed: function (num) { + pseudoRandomArray = []; + + if (isNaN(num)) + throw new Error("Invalid argument to math.randomseed"); + + if(!pseudoRandomArray[num]) + { + pseudoRandomArray[num] = Math.random(); + } + return pseudoRandomArray[num]; + }, +/**@Deprecated. This API converts the float value to an integer. The converted integer value is always the integer part of the specified float number (number before the decimal).*/ + toInteger: function (num) { + num -= 0; + if (isNaN(num)) { + throw new Error("Invalid argument to math.tointeger"); + } + + return Math.floor(num); + }, + + /**@Deprecated. This API raises the first parameter to the power of the second parameter and returns the result.*/ + pow: function (num1, num2) { + + num1 -= 0; + num2 -= 0; + + if (isNaN(num1) || isNaN(num2)) { + throw new Error("Invalid argument(s) to math.pow"); + } + + return Math.pow(num1, num2); + }, + + findExtreme: function(extreme, args) { + if (args.length < 2) { + throw new Error((extreme ? "math.max" : "math.min") + " needs atleast two arguments"); + } + + var result = args[0] - 0; + if (isNaN(result)) { + throw new Error("Invalid argument to " + (extreme ? "math.max" : "math.min")); + } + + for (var i = 1; i < args.length; i++) { + args[i] -= 0; + if (isNaN(args[i])) { + throw new Error("Invalid argument to " + (extreme ? "math.max" : "math.min")); + } + + if (extreme) { + if (result < args[i]) { + result = args[i]; + } + } else { + if (result > args[i]) { + result = args[i]; + } + } + } + + return result; + }, + + /**@Deprecated. This API returns the minimum value among the arguments.*/ + min: function () { + return kony.math.findExtreme(false, arguments); + }, + + /**@Deprecated. This API returns the maximum value among the arguments.*/ + max: function () { + return kony.math.findExtreme(true, arguments); + }, + + /**@Deprecated. This API returns the square root of the given number.*/ + sqrt: function (num) { + + num -= 0; + if (isNaN(num)) { + throw new Error("Invalid argument to math.sqrt"); + } + var result = Math.sqrt(num); + return isNaN(result) ? "nan" : result; + } +} + +/**The string Library has APIs that you can use to manipulate strings. The kony.string name space provides static string APIs. These static APIs augment the APIs in the Global string object which is available by default. For more information refer, https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/string.*/ +kony.string = { + +/**@Deprecated This API finds the first occurrence of the search string in the source string. */ + find : function () { + if (arguments.length < 2) { + throw new Error("string.find needs atleast two arguments"); + } + + for (var i = 0; i < 2; i++) { + if (typeof(arguments[i]) === "number") { + arguments[i] = arguments[i].toString(); + } else if (typeof(arguments[i]) !== "string") { + throw new Error("Invalid argument(s) to string.find"); + } + } + + var beginIndex = 0; + if (arguments.length > 2) { + beginIndex = arguments[2] - 0; + if (!isNaN(beginIndex)) { + if (beginIndex < 0) { + beginIndex += arguments[0].length; + if (beginIndex < 0) beginIndex = 0; + } + } else { + beginIndex = 0; + } + } + + var result = arguments[0].indexOf(arguments[1], beginIndex - 1); + if (-1 === result) { + return null; + } else { + ////result++; + //return result, result + arguments[1].length - 1; + return result; + } + }, + + /**@Deprecated This API returns the length of the source string. */ + len: function (s) { + if (0 === arguments.length) { + throw new Error("string.len needs atleast one argument"); + } + + if (typeof(s) === "number") { + s = s.toString(); + } else if (typeof(s) !== "string") { + throw new Error("Invalid argument to string.len"); + } + + return arguments[0].length; + }, + + /**@Deprecated This API compares the contents of two strings numerically. For example, "Adam" is smaller than "adam" as per the ASCII table because A(65) is smaller than a(97). */ + compare: function (s1, s2) { + if (arguments.length < 2) { + throw new Error("string.compare needs atleast two arguemnts"); + } + + if (typeof(s1) == "string" && typeof(s2) == "string") { + if (s1 < s2) { + return -1; + } else if (s1 == s2) { + return 0; + } else { + return 1; + } + } else { + throw new Error("Invalid argument(s) to string.compare"); + } + }, + + /**@Deprecated This API returns a string which contains a single character from the source string at the specified index. */ + charat: function (s1, index) { + if (arguments.length < 2) { + throw new Error("string.charat needs atleast two arguments"); + } + + if (typeof(s1) === "number") { + s1 = s1.toString(); + } else if (typeof(s1) !== "string") { + throw new Error("Invalid argument to string.charat"); + } + + index -= 0; + if (isNaN(index)) { + throw new Error("Invalid argument to string.charat"); + } + + ////index--; + if (index < 0 || index >= s1.length) { + return null; + } + + return s1.charAt(index); + }, + + flipCase: function(args, flag) { + if (0 === args.length) { + throw new Error(flag ? "string.upper" : "string.lower" + " needs atleast one argument"); + } + + if (typeof(args[0]) !== "string") { + throw new Error("Invalid argment to " + flag ? "string.upper" : "string.lower"); + } + + if (flag) { + return args[0].toUpperCase(); + } else { + return args[0].toLowerCase(); + } + }, + /**@Deprecated This API changes the upper case characters of the source string to lower case characters. */ + lower: function () { + return kony.string.flipCase(arguments, false); + }, +/**@Deprecated This API changes the lower case characters of the source string to upper case characters.*/ + upper: function () { + return kony.string.flipCase(arguments, true); + }, + + /**This API generates a string which is equivalent to "n copies of the source string concatenated together".*/ + rep: function (s,n) { + if (arguments.length < 2) { + throw new Error("Insufficient arguments to string.rep"); + } + + if (typeof(s) === "number") { + s = s.toString(); + } else if (typeof(s) !== "string") { + throw new Error("Invalid argument to string.rep"); + } + + n -= 0; + if (isNaN(n)) { + throw new Error("Invalid argument to string.rep"); + } + + var resultStr = ""; + for (var i = 0; i < n; i++) { + resultStr += s; + } + + return resultStr; + }, + + /**This API reverses the characters in the source string.*/ + reverse: function (s) { + if (0 === arguments.length) { + throw new Error("string.reverse needs atleast one argument"); + } + + if (typeof(s) === "number") { + s = s.toString(); + } else if (typeof(s) !== "string") { + throw new Error("Invalid argument to string.reverse"); + } + + var resultStr = ""; + for (var i = s.length - 1; i >= 0; i--) { + resultStr += s.charAt(i); + } + + return resultStr; + }, + /**This API removes the leading and ending spaces from the source string.*/ + trim: function (s) { + if (0 === arguments.length) { + throw new Error("string.trim needs atleast one argument"); + } + + if(s === undefined) { + return s; + } + else if (typeof(s) !== "string") { + return s.toString(); + //throw new Error("Invalid argument to string.trim"); + } + + return s.replace(/^\s*/, "").replace(/\s*$/, ""); + }, + /**Determines whether two strings contain the same data, ignoring the case of the letters in the String. */ + equalsIgnoreCase: function (s1, s2) { + if (arguments.length < 2) { + throw new Error("string.equalsIgnoreCase needs atleast two arguments"); + } + + if (typeof(s1) !== "string" || typeof(s2) !== "string") { + throw new Error("Invalid argument(s) to string.equalsIgnoreCase"); + } + + return (s1.toLowerCase() === s2.toLowerCase()); + }, + + equals: function (s1, s2) { + if (arguments.length < 2) { + throw new Error("string.equals needs atleast two arguments"); + } + + if (typeof(s1) !== "string" || typeof(s2) !== "string") { + throw new Error("Invalid argument(s) to string.equals"); + } + + return (s1 === s2); + }, + + matchEnds: function (args, end) { + if (args.length < 2) { + throw new Error(end ? "string.endsWith" : "string.startsWith" + + " needs atleast two arguments"); + } + + if (typeof(args[0]) !== "string" || typeof(args[1]) !== "string") { + throw new Error("Invalid argument(s) to " + end ? "string.endsWith" : "string.startsWith"); + } + + if (!(args.length > 2 && (args[2] === false || args[2] === null))) { + args[0] = args[0].toLowerCase(); + args[1] = args[1].toLowerCase(); + } + + if (end) { + var ll = args[0].lastIndexOf(args[1]); + if(ll < 0){ + return false; + }else{ + return (args[0].lastIndexOf(args[1]) === args[0].length - args[1].length); + } + } + else { + return (args[0].indexOf(args[1]) === 0); + } + }, + /**This API returns a boolean value indicating if the source string begins with the specified string. */ + startsWith: function (sourcestring, comparestring, ignorecase) { + return kony.string.matchEnds(arguments, false); + }, + /**This API returns a boolean value indicating if the source string ends with the specified string. */ + endsWith: function (sourcestring, comparestring, ignorecase) { + return kony.string.matchEnds(arguments, true); + }, + /**@Deprecated This API splits the source string based on the separator (default is comma) and returns a table containing the string. */ + split: function (s, sep) { + if (0 === arguments.length) { + throw new Error("string.split needs atleast one argument"); + } + + if (typeof(s) !== "string") { + throw new Error("Invalid argument to string.split"); + } + + var delim; + if (arguments.length > 1) { + if (typeof(sep) !== "string") { + throw new Error("The optional delimitor for string.split must be a string"); + } + + delim = sep; + } else { + delim = ","; + } + + var splitstr = new Array(); + + if(delim == "") { + splitstr[1] = s; + } else { + splitstr = s.split(delim); + splitstr.unshift(null); //To match lua Array indexing. + } + return splitstr; + }, + /**@Deprecated This API returns the substring of the source string. */ + sub: function () { + function getIndex(i, len) { + if (typeof(i) === "string") { + i -= 0; + } else if (typeof(i) !== "number") { + throw new Error("Invalid argument to string.sub"); + } + + if (i < 0) { + ////return (i + len + 1); + return( i + len - 1); + } else if (i > len) { + return len; + } + + return i; + } + + function adjustIndex(i) { + if (i > 0) { + return i - 1; + } else { + return 0; + } + } + + if (arguments.length < 2) { + throw new Error("string.sub needs atleast two arguments"); + } + + var args = []; + for(var i=0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + if (typeof(args[0]) === "number") { + args[0] = args[0].toString(); + } else if (typeof(args[0]) !== "string") { + throw new Error("Invalid argument to string.sub"); + } + + var startIndex = getIndex(args[1], args[0].length); + var endIndex = args[0].length; + if (args.length > 2) { + endIndex = getIndex(args[2], args[0].length); + } + + if (endIndex < startIndex || (0 === startIndex && endIndex === startIndex)) { + return ""; + } else { + ////startIndex = adjustIndex(startIndex); endIndex = adjustIndex(endIndex); + return args[0].slice(startIndex, endIndex + 1); + } + }, + /**@Deprecated This API finds and replaces the occurrences of a string in the source string with a string you specify. */ + replace: function (s, f, rep) { + if (arguments.length < 3) { + throw new Error("string.replace needs atleast three arguments"); + } + + if (typeof(s) !== "string" || typeof(f) !== "string" || + typeof(rep) !== "string") { + throw new Error("Invalid argument(s) to string.replace"); + } + + //return [s.replace(f, rep)]; + + // Replace all occurrences + //var exp1 = new RegExp(f, "g"); + var exp1 = new RegExp(kony.string.escapeRegExp(f), "g"); + return (s != "" && f == "") ? s : s.replace(exp1, rep); + }, + /* + format: function (args) { + if (0 === args.length) { + throw new Error("string.format needs atleast one argument"); + } + + if (typeof(args[0]) === "number") { + return args[0].toString(); + } else if (typeof(args[0]) === "string") { + var toks = args[0].split(/(%[f,s,b])/); + + var flag = false; + var result = ""; + for (var i = 0, j = 1; i < toks.length; i++) { + if ("%f" === toks[i] || "%s" === toks[i] || "%b" === toks[i]) { + if (j === args.length) { + throw new Error("Insufficient number of arguments to string.format"); + } + + if ("%f" === toks[i]) { + var num = args[j] - 0; + + if (isNaN(num)) { + throw new Error("Invalid argument to string.format"); + } + + result += num; + } else if ("%s" === toks[i]) { + result += args[j].toString(); + } else if ("%b" === toks[i]) { + if (args[j] === false || args[j] === null) { + result += "false"; + } else { + result += "true"; + } + } + + j++; + } else { + result += toks[i]; + } + } + + return result; + } else { + throw new Error("Invalid first argument to string.format"); + } + }, */ + /** This API verifies if the input string contains only ASCII alphabet characters and returns a boolean value. */ + isAsciiAlpha: function (s) { + + if (arguments.length === 0) { + throw new Error("string.isAsciiAlpha needs atleast 1 argument"); + } + + if (typeof(s) !== "string") { + throw new Error("Invalid argument(s) to string.isAsciiAlpha"); + } + + var regexp = new RegExp("[^a-zA-Z]","g"); + return (s == "") ? false : !(regexp.test(s)); + }, + /** This API verifies if the input string contains only ASCII alphabet characters and numbers, and returns a boolean value.*/ + isAsciiAlphaNumeric: function (str) { + + if (arguments.length === 0) { + throw new Error("string.isAsciiAlphaNumeric needs atleast 1 argument"); + } + var p1 = /[^a-zA-Z0-9]/i; // Elimimate non alpha numeric chars //Added cap letters also + var p2 = /^[a-zA-Z0-9]*$/i; /* Wrong regex /([a-z]+[0-9])|([0-9]+[a-z])/i; */ + var r1 = str.match(p1); + var r2 = str.match(p2); + return (!r1 && r2 && str) ? true : false; + }, + + /** This API verifies if the input string contains only numeric characters, and returns a boolean value.*/ + isNumeric: function (s) { + if (arguments.length === 0) { + throw new Error("string.isNumeric needs atleast 1 argument"); + } + + /*if (typeof(args[0]) !== "string") { + throw new Error("Invalid argument(s) to string.isNumeric"); + }*/ + + return (s == "" || (typeof(s) == "string" && s.replace(/\s/g,'').length == 0)) ? false : !(isNaN(s)); + }, + /** This API verifies if any one of the specified set of characters is available in the given string and returns a boolean value.*/ + containsChars: function (s, a) { + if (arguments.length === 0) { + throw new Error("string.containsChars needs 2 arguments"); + } + + if (typeof(s) !== "string") { + throw new Error("Invalid argument(s) to string.containsChars"); + } + + if (a instanceof Array === false) { + throw new Error("Invalid argument to table.containsChars"); + } + + var charset = []; + var charstr = ""; + var chararray = a; + var len = chararray.length; + var result = false; + + for(var i=0; i 4 ? 4 : (arguments.length - 1); + switch (arguments.length) { + case 4: + arguments[3] -= 0; + if (isNaN(arguments[3])) { + isArgsError = true; + } + end = arguments[3]; + case 3: + arguments[2] -= 0; + if (isNaN(arguments[2]) || arguments[2] < 0) { + isArgsError = true; + } + begin = arguments[2]; + case 2: + sep = arguments[1]; + default: + break; + } + + if (len == 0) + return kony.table.returnResult("", isArgsError, isInternalError); + + if (isArgsError) + return kony.table.returnResult(result, isArgsError, isInternalError); + + if (begin > end) { + //isArgsError = true; // return empty string -- lua std + return kony.table.returnResult("", isArgsError, isInternalError); + } + else + if (end > len) { + isArgsError = true; + } + else + if (!isArgsError) { + result = ""; + try { + for (var i = begin; i < end; i++) { + if(arguments[0][i] == null || arguments[0][i] instanceof Object) + return kony.table.returnResult(null, true, isInternalError); + result += arguments[0][i].toString() + sep; + } + result += arguments[0][i].toString(); + + } + catch (e) { + isInternalError = true; + } + } + } + return kony.table.returnResult(result, isArgsError, isInternalError); + }, + + /*maxn: function(args) { + if (0 === arguments.length) { + throw new Error("table.maxn needs atleast one argument"); + } + + if (args[0] instanceof LuaTable === false) { + throw new Error("Invalid argument to table.maxn"); + } + + var maxIndex = args[0].arrayContainer.length - 1; + for (var obj in args[0].hashContainer) { + var key = args[0].hashContainer[obj].key; + if (args[0].hashContainer[obj].value !== null && + typeof(key) === "number" && + maxIndex < key) { + maxIndex = key; + } + } + return maxIndex; + },*/ + /**@Deprecated This API inserts a specified value into the given table in the list part. If a position is specified, the value is inserted before the element currently at that position. If no position is specified, the value is appended to the end of the table. If the specified position is not within the range of the list part of the table, the new element is added to the hash part of the table.*/ + insert: function(inputtable, position, value) { + + var isArgsError = false; + var isInternalError = false; + var result = null; + + if (arguments.length < 2 || !(arguments[0] instanceof Object)) { + isArgsError = true; + } + + if (!isArgsError) { + + var pos, newItem; + // var arr = arguments[0]; + if (arguments.length > 2) { + pos = arguments[1]; + if (typeof pos == "string" || isNaN(pos)) { + return kony.table.returnResult(true, isInternalError); + } + newItem = arguments[2]; + } + else { + pos = arguments[0].length; + newItem = arguments[1]; + /*if(args[1] == null) // don't insert nil at the end of table -- lua std + return kony.table.returnResult(args[0], isArgsError, isInternalError);*/ + } + + try { + if (typeof pos == "string" || pos >= arguments[0].length || pos <= 0) { + if (pos == 0) { + //DEF 3809 + arguments[0].splice(pos,0,newItem); + //arguments[0][pos] = newItem; + } + else { + arguments[0][pos] = newItem; + } + } + else{ + /* var pre = arguments[0].slice(0, pos); + var post = arguments[0].slice(pos); + pre.push(newItem); + arguments[0] = pre.concat(post);*/ + arguments[0].splice(pos,0,newItem); + } + //arguments[0] = arr; + } + catch (e) { + isInternalError = true; + } + } + return kony.table.returnResult(isArgsError, isInternalError); + }, + /**@Deprecated This API removes an element from the list part of the table. If a position is specified, the element at the position is removed. If no position is specified, the last element in the table is removed. The removed element is returned. This API operates only on the list part of the table.*/ + remove: function(inputtable, position) { + + var isArgsError = false; + var result = null; + + if (0 === arguments.length || !(arguments[0] instanceof Array)) { + isArgsError = true; + } + + if (!isArgsError) { + var pos = arguments[0].length - 1 ; + if (pos >= 0) { + if (arguments.length > 1 && arguments[1] != null) { + arguments[1] -= 0; + if (isNaN(arguments[1]) || arguments[1] > pos || arguments[1] < 0) { + isArgsError = true; + return kony.table.returnResult(result, isArgsError, false); + } + + if (arguments[1] < pos && arguments[1] >= 0) { + pos = arguments[1] //-1;//5.0 Decremented + } + } + result = arguments[0].splice(pos, 1); + result = result[0] ; + /*for(var i=pos;i > 0;i--){ + result = args[0].arrayContainer.splice(i, 1); + if(result[0] == null && i == args[0].length()+1) + continue; + else + break; + }*/ + } + else + return kony.table.returnResult(null, isArgsError, false); + } + return kony.table.returnResult(result, isArgsError, false); + }, + +/**@Deprecated This API sorts the elements of the input table and returns the modified table. This API sorts only the list part of the table and the hash part of the table is ignored.*/ + sort: function(inputtable, sortkey, comparisonfunction) { + + var isArgsError = false; + var isInternalError = false; + var result = null; + var comparator = null; + + + if (0 === arguments.length || !(arguments[0] instanceof Array)) { + isArgsError = true; + } + + if (typeof(arguments[1]) == "function") { + comparator = arguments[1]; + } + else + if (typeof(arguments[2]) == "function") { + comparator = arguments[2]; + } + + if (!isArgsError) { + var len = arguments[0].length; + var pre = arguments[0]; + + if(arguments[0].length < 2){ + //Can't do aything. Need more than one element to sort + return kony.table.returnResult(inputtable,false,false); + } + + try { + for (var i = 0; i < len; i++) { //5.0 Decremented i + var elemType = typeof(arguments[0][1]); + if (arguments[0][i] == null || typeof(arguments[0][i]) != elemType) { + + return kony.table.returnResult(true, isInternalError); + } + } + + // pre = arguments[0].slice(1); + //var zeroth = arguments[0].shift(); + + //This is to splice the array to the length to which it has to be sorted + if(arguments[1] !== null && !isNaN(arguments[1])) + pre.splice(arguments[1],pre.slice(arguments[1],pre.length).length); + + if (comparator) { + pre.sort(function(a, b){ + var retVals = comparator(a, b); + + return (retVals ? -1 : 1); + }); + } + else + if (typeof arguments[1] == "string") { + comparator = arguments[1]; + pre.sort(function(a, b){ + if (a[comparator] != null && typeof a[comparator] == typeof b[comparator] && typeof a[comparator] == "string") { + var nameA = a[comparator].toLowerCase(), nameB = b[comparator].toLowerCase() + if (nameA < nameB) //sort string ascending + return -1 + if (nameA > nameB) + return 1 + return 0 //default return value (no sorting) + } + else { + return a[comparator] - b[comparator]; + } + }); + } + else { + pre.sort(function(a, b){ + if (typeof a == "string") { + var A = a.toLowerCase(); + var B = b.toLowerCase(); + if (A < B) { + return -1; + } + else + if (A > B) { + return 1; + } + else { + return 0; + } + } + else + return a - b; + + }); + + } + // pre.unshift(zeroth); + // pre = pre.concat(arguments[0]); + } + catch (e) { + isInternalError = true; + pre = null; + } + } + if (!isArgsError && !isInternalError) + return kony.table.returnResult(pre, isArgsError, isInternalError); + else + return kony.table.returnResult(true, isInternalError); + }, +/**@Deprecated This API filters the given table based on the provided criteria and returns a set of values that match the given criteria.*/ + filter: function(srctable, mapfunc) { + + + var isArgsError = false; + var isInternalError = false; + var tgttable; + + if (arguments.length < 2 || !(srctable instanceof Object) || !(typeof(mapfunc) == "function")) { + isArgsError = true; + } + + if (!isArgsError) { + + var key, value, retVals; + + if ((srctable instanceof Array) && mapfunc) { + try { + tgttable = []; + for (var i = 0; i < srctable.length; i++) {//5.0 Decremented i + value = srctable[i]; + if (value instanceof Object) { + /*var innerLen = value.length(); + var innerValue; + var count = 0; + for (var k = 0; k < innerLen; k++) { + innerValue = value.arrayContainer[k + 1]; + retVals = executeClosure(mapfunc, [k + 1, innerValue]); + if (retVals[0] == true) + count++; + } + if (count == innerLen) + tgttable.arrayContainer.push(value);*/ + return kony.table.returnResult(null, true, isInternalError); + } + else { + + if (value != null) + retVals = mapfunc(i, value); + if (retVals === true) + tgttable.push(value); + retVals = false; + } + + } + } + catch (e) { + isArgsError = true; + } + } + else + if (srctable && mapfunc) { + tgttable = new Object(); + + try { + for (var j in srctable) { + key = j + value = srctable[j]; + if (value != null) + retVals = mapfunc(j, value); + if (retVals === true) { + tgttable[key] = value; + } + retVals = false; + } + } + catch (e) { + isArgsError = true; + } + } + } + + if (isArgsError || isInternalError) + tgttable = null; + + return kony.table.returnResult(tgttable, isArgsError, isInternalError); + }, + /**@Deprecated This API performs the given action on the input table and returns the modified table.*/ + map : function(srctable, mapfunc) { + + var isArgsError = false; + var isInternalError = false; + + if (arguments.length < 2 || (srctable instanceof Object === false) || !(typeof(mapfunc) == "function")) { + isArgsError = true; + } + + if (!isArgsError) { + + try { + + var key, value, retVals; + + if (srctable instanceof Array && mapfunc) { + var len = srctable.length; + + for (var i = 0; i < len; i++) {//5.0 Decremented i + if (srctable[i] instanceof Array || srctable[i] == null) { + return kony.table.returnResult(true, isInternalError); + } + } + + try { + for (var i = 0; i < len; i++) {//5.0 Decremented i + value = srctable[i]; + retVals = mapfunc(i, value); + if (retVals !== false) { + key = retVals[0]; + value = retVals[1]; + srctable[key] = value; + retVals = false; + } + else + return kony.table.returnResult(true, isInternalError); + } + } + catch (e) { + isArgsError = true; + } + } else + if (srctable && mapfunc) { + + try { + for (var j in srctable) { + key = j; + value = srctable[key]; + retVals = mapfunc(key, value); + + if (retVals !== false) { + key = retVals[0]; + value = retVals[1]; + srctable[key] = value; + retVals = false; + } + else + return kony.table.returnResult(true, isInternalError); + } + } + catch (e) { + isArgsError = true; + } + } + } + catch(e){ + isInternalError = true; + } + } + //srctable added for JSPFQA5653 + return kony.table.returnResult(srctable, isArgsError, isInternalError); + + }, + /**@Deprecated This API performs the given action on the input table and returns a new table.*/ + mapNew: function(srctable, mapfunc){ + + var isArgsError = false; + var isInternalError = false; + + if (arguments.length < 2 || (srctable instanceof Object === false) || !(typeof(mapfunc) == "function")) { + isArgsError = true; + } + + if(srctable == null) + return kony.table.returnResult(null, isArgsError, isInternalError); + + try { + + var tgttable = null; + var key, value, retVals; + + if (!isArgsError) { + + if (srctable instanceof Array && mapfunc) { + var len = srctable.length; + + for (var i = 0; i < len; i++) {//5.0 Decremented i + if (srctable[i] instanceof Object || srctable[i] == null) { + return kony.table.returnResult(null, true, isInternalError); + } + } + + try { + + tgttable = []; + for (var i = 0; i < len; i++) {//5.0 Decremented i + value = srctable[i]; + retVals = mapfunc(i, value); + key = retVals[0]; + value = retVals[1]; + tgttable[key] = value; + } + } + catch (e) { + isArgsError = true; + } + + } else + if (srctable && mapfunc) { + + try { + tgttable = new Object(); + for (var j in srctable) { + key = j; + value = srctable[key]; + retVals = mapfunc(key, value); + + if (retVals !== false) { + key = retVals[0]; + value = retVals[1]; + tgttable[key] = value; + retVals = false; + } + else + return kony.table.returnResult(true, isInternalError); + } + } + catch (e) { + isArgsError = true; + } + } + } + } + catch (e) { + isInternalError = true; + } + + if (isArgsError || isInternalError) + tgttable = null; + return kony.table.returnResult(tgttable, isArgsError, isInternalError); + + }, +/**@Deprecated This API searches the given input table and returns the value at the specified key; if the key is a number, this API returns the value at the index.*/ + get: function(srctable, key) { + + var isArgsError = false; + var isInternalError = false; + var invalidKey = false; + var result = null; + + //TODO:Error Check + if (arguments.length < 2 || srctable instanceof Object === false || key == null) { + isArgsError = true; + return kony.table.returnResult(result, isArgsError, isInternalError); + } + + try { + if (key in srctable) { + result = srctable[key]; + } else + invalidKey = true; + } + catch (e) { + isInternalError = true; + } + + return kony.table.returnResult(result, isArgsError, isInternalError, invalidKey); + }, +/**@Deprecated Tests if the specified key is part of the table.*/ + contains: function(srctable, key) { + + var isArgsError = false; + var isInternalError = false; + var result = false; + + if (arguments.length < 2 || srctable instanceof Object === false || key == null) { + return kony.table.returnResult(result, true, isInternalError); + } + + try { + if (key in srctable) + result = true; + } + catch (e) { + isInternalError = true; + } + return kony.table.returnResult(result, isArgsError, isInternalError); + }, +/**@Deprecated This API appends the content of the source table to the target table and returns the modified target table.*/ + append: function(tgttable, srctable) { + + var isArgsError = false; + var isInternalError = false; + + if (arguments.length != 2 || !(tgttable instanceof Object) || !(srctable instanceof Object)) { + isArgsError = true; + return kony.table.returnResult(null, isArgsError, isInternalError); + } + + try { + if (tgttable.length && srctable.length) { + //// var srcarray = srctable.slice(1); //4906 + for (var i = 0; i < srctable.length; i++) { + tgttable.push(srctable[i]); + } + } else { + + for (var j in srctable) { + tgttable[j] = srctable[j]; + } + } + } + catch (e) { + isInternalError = true; + } + + return kony.table.returnResult(tgttable, isArgsError, isInternalError); + }, + /**@Deprecated This API removes data from the table represented by the table id.*/ + removeAll: function(srctable) { + + if (arguments.length < 1) { + throw new Error("table.removeAll needs atleast 1 argument"); + } + + //TODO:Proper error function to distinguish between table (object) & other types + if (typeof(srctable) != "object") { + throw new Error("Invalid arguments to table.removeAll"); + } + + if(srctable.length) + srctable.length = 0; + else { + for (var key in srctable) { + delete srctable[key]; + } + } + + return; + }, + + /**@Deprecated unpack + +This API returns the elements from the given table. This function is equivalent to + +return list[i], list[i+1], .... list[j].*/ + unpack: function (t1) { + + if (0 === arguments.length) { + throw new Error("unpack needs atleast one argument"); + } + + if (t1 instanceof Object === false) { + throw new Error("Invalid first argument to unpack"); + } + + var numArgs = arguments.length > 3 ? 3 : arguments.length; + var maxIndex = arguments[0].length; + var beginIndex = 0 /*5.0 Decremented beginIndex*/, endIndex = maxIndex; + switch (numArgs) { + case 3: + arguments[2] -= 0; + if (isNaN(arguments[2])) { + throw new Error("Invalid argument to unpack"); + } + endIndex = arguments[2]; + case 2: + arguments[1] -= 0; + if (isNaN(arguments[1])) { + throw new Error("Invalid argument to unpack"); + } + beginIndex = arguments[1]; + default: + break; + } + + if (beginIndex > endIndex) { + return [""]; + } else { + var retVals = "";//[]; //4907 + for (var i = beginIndex; i < endIndex; i++) { + //retVals.push(arguments[0][i]); + if(i == 0){ + retVals = arguments[0][i]; + }else{ + retVals = retVals + " " + arguments[0][i]; + } + } + return retVals; + } + }, + + // local myjson = '{ "name": "Shasank", "id": "417" }' + // table.parsejson(myjson) + /*parsejson: function(args){ + + if (arguments.length < 1) { + throw new Error("table.parsejson needs atleast 1 argument"); + } + + var jsObj = args[0].evalJSON(); + + try { + var tgttable = kony.utils.json2LuaTable(jsObj); + } + catch (e) { + throw new Error("table.parsejson - SyntaxError: Badly formed JSON string"); + } + + return tgttable; + },*/ + + /*keys: function(args){ + + if (arguments.length < 1) { + throw new Error("table.keys needs atleast 1 argument"); + } + + if (args[0] instanceof LuaTable === false) { + throw new Error("Invalid arguments to table.keys"); + } + + var srctable = args[0]; + + if (srctable.hashKeys.length) { + + var innerlen = srctable.hashKeys.length; + var key; + var keysarray = []; + for (var j = 0; j < innerlen; j++) { + key = srctable.hashKeys[j]; + keysarray.push(key); + } + + return keysarray; + } + },*/ + + returnResult: function() { + + var errorNo = null; + var errorMsg = null; + var isArgsError = false; + var isInternalError = false; + + if (arguments.length >= 3) { + + var retArray = arguments[0]; + isArgsError = arguments[1]; + isInternalError = arguments[2]; + var invalidKey = arguments[3]; + } + else{ + isArgsError = arguments[0]; + isInternalError = arguments[1]; + } + if(isArgsError) { + errorNo = 100; + errorMsg = "INVALID ARGUMENTS"; + } + else if(isInternalError){ + errorNo = 101; + errorMsg = "INTERNAL ERROR"; + } + else if(invalidKey){ + errorNo = 0; + errorMsg = "INVALID KEY"; + } + if (arguments.length >= 3) + //return ([retArray, errorNo, errorMsg]); + return retArray; + else if(arguments.length == 2 && (isArgsError || isInternalError)) + return ([errorNo, errorMsg]); + else + return; + } +} + +/**@Deprecated This API returns the current time as a string in hh:mm:ss format. The time is represented in 12 hour format.*/ + kony.os.time = function () { + var timeStr = (new Date()).toTimeString(); + + return timeStr.slice(0, timeStr.indexOf(" ")); + }; + /**@Deprecated This API returns the number of seconds between the first input parameter (t1) to the second input parameter (t2).*/ + kony.os.diffDateTime = function (time1, time2) { + + if (typeof(time1) !== "string" || typeof(time2) !== "string") { + throw new Error("Invalid argument(s) to os.diffDateTime"); + } + + var t1 = time1.split(":");t1[2] = t1[2] - 0; + var t2 = time2.split(":");t2[2] = t2[2] - 0; + var one_day = 86400; + var t1sec = t1[0] * 3600 + t1[1] * 60 + t1[2]; + var t2sec = t2[0] * 3600 + t2[1] * 60 + t2[2]; + + return (t1sec > one_day || t2sec > one_day ) ? null : t1sec - t2sec; + }; + /**@Deprecated This API formats the current date to the given format.*/ + kony.os.date = function () { + + var result; + var currentDate = new Date(); + + if (0 === arguments.length) { + var timeStr = currentDate.toTimeString(); + result = kony.os.padZero(currentDate.getMonth() + 1) + "/" + kony.os.padZero(currentDate.getDate()) + "/" + kony.os.padZero(currentDate.getFullYear() % 100) + " " + timeStr.slice(0, timeStr.indexOf(" ")); + return result; + } + else if (typeof(arguments[0]) == "string") { + + if (arguments[0].toLowerCase().indexOf("dd") != -1) { + + return kony.os.formatdate(arguments[0], currentDate); + } + else { + var utc = arguments[0].charAt(0) === '!'; + var index = utc ? 1 : 0; + if ('*' === arguments[0].charAt(index) && 't' === arguments[0].charAt(index + 1)) { + var day = utc ? currentDate.getUTCDate() : currentDate.getDate(); + var mon = (utc ? currentDate.getUTCMonth() : currentDate.getMonth()) + 1; + var year = utc ? currentDate.getUTCFullYear() : currentDate.getFullYear(); + + result = new Object(); + result["year"] = year; + result["month"] = mon; + result["day"] = day; + result["hour"] = utc ? currentDate.getUTCHours() : currentDate.getHours(); + result["min"] = utc ? currentDate.getUTCMinutes() : currentDate.getMinutes(); + result["sec"] = utc ? currentDate.getUTCSeconds() : currentDate.getSeconds(); + result["wday"] = utc ? currentDate.getUTCDay() : currentDate.getDay() + 1; + result["yday"] = kony.os.getDayOfYear(day, mon, year); + result["isdst"] = utc ? false : kony.os.checkForDst(); + return result; + } + else + return null; + } + } else + return null; + }; +/**This API allows you to convert the given number to represent currency. At present, only USA currency is supported.*/ + kony.os.toCurrency = function (arg) { + + arg -= 0; + if (isNaN(arg)) { + throw new Error("Invalid argument to os.toCurrency"); + } + + if (arg < 0) arg *= -1; + var str = arg.toFixed(3); + str = str.substr(0,str.length-1); + var outStr = ""; + for (var i = 0; i < str.length - 4; i++) { + outStr += str.charAt(i); + if ((str.length - i - 1) % 3 === 0) outStr += ","; + } + + for (; i < str.length; i++) { + outStr += str.charAt(i); + } + + return "$" + outStr; + }; + /**This API converts the argument to a number. If the argument is already a number or a string convertible to a number, then the API returns this number; otherwise, it returns null for JavaScript and nil for Lua.*/ + kony.os.toNumber = function (arg) { + + if (arguments.length != 1) { + throw new Error("Invalid argument to os.toNumber"); + } + + if (typeof(arg) === "number") { + return arg; + } else if (typeof(arg) === "string") { + + var str = arg.replace(/^\s*/, '').replace(/\s*$/, ''); + if (str === '') { + return null; + } else { + var num = str - 0; + return (isNaN(num) ? null : num); + } + + } else { + return null; + } + }; + /**@Deprecated This API returns the difference in dates or compares two dates for equality.*/ + //os.compareDates(date1,date2,"format") - dd,mm,yyyy,yy + kony.os.compareDates = function (d1, d2, frmt){ + + if(d1 == null || d2 == null || frmt == null || !kony.os.isvaliddate(d1,frmt) || !kony.os.isvaliddate(d2,frmt)) + return null + + var date1 = kony.os.getDate(d1, frmt); + var date2 = kony.os.getDate(d2, frmt); + var oneday = 24*60*60*1000; + + return parseInt((date1.getTime() - date2.getTime())/oneday); + }; +/**@Deprecated This API adds or subtracts units (days, hours, minutes, month, or years) to the given date.*/ + //os.addToDate(date1,format,units,count) - units : days,hours,minutes,month,years + // Format"dd/mm/yyyy" or "mm/dd/yyyy" or mm/dd/yy + kony.os.addToDate = function (d1, frmt, unt, cnt){ + + if (d1 == null || frmt == null || unt == null || cnt == null) { + return null; + } + var inputDate = d1; + var fmt = frmt; + var unit = unt; + var count = cnt; + var dateParts = inputDate.split("/"); + + if(!kony.os.isvaliddate(inputDate,fmt)) + return null; + + var dateObj = kony.os.getDate(inputDate, fmt); + + if (dateObj) { + switch (unit) { + case "years": + dateObj.setFullYear(dateObj.getFullYear() + count); + break; + case "months": + dateObj.setMonth(dateObj.getMonth() + count); + break; + case "days": + dateObj.setDate(dateObj.getDate() + count); + break; + case "hours": + dateObj.setHours(dateObj.getHours() + count); + break; + case "minutes": + dateObj.setMinutes(dateObj.getMinutes() + count); + break; + default: + break; + } + if(kony.os.isLeapYear([d1,fmt]) && dateObj.getMonth() >= 1 && (unit == "years" || (unit == "months" && (count == -12 || count == 12))) ) + dateObj.setDate(dateObj.getDategetDate() - 1); + + return kony.os.formatdate(fmt,dateObj); + + } + return null; + }; + /**@Deprecated This API checks if the input year is a leap year.*/ + //os.isLeapYear(yyyy) + kony.os.isLeapYear = function (d1, frmt) { + var year; + var date = new Date(); //Take the current year; + year = date.getFullYear(); + + if (typeof(d1) == "string" && typeof(frmt) == "string") { + + if(!kony.os.isvaliddate(d1, frmt)) + return false; + + var yearPart = d1.split("/")[2]; + year = (yearPart.length == 2) ? parseInt(date.getFullYear().toString().substr(0, 2) + yearPart) : parseInt(yearPart); + } + + if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) { + return true; + } + else { + return false; + } + }; +/**@Deprecated This API converts a given date string to the target format and returns the formatted date. Format will use the tokens dd,mm,yyyy to indicate day, month, and year respectively. The delimiter used between the tokens can be any character. For example, dd/mm/yyyy and (dd)(mm)(yyyy) are valid inputs.*/ + //os.formatdate(inputdate[string],sourceformat[string],targetformat[string]) + kony.os.formatDate = function (d1, sfrmt, tgtfrmt) { + + var year; + if(d1 == null || sfrmt == null || tgtfrmt == null) { + return null; + } + else if(typeof(d1) === "string" && typeof(sfrmt) === "string" && typeof(tgtfrmt) === "string") { + + var inputDate = d1 + var srcfmt = sfrmt; + var targetfmt = tgtfrmt; + + var datePos = srcfmt.indexOf("dd"); + var monthPos = srcfmt.indexOf("mm"); + var yearPos = (srcfmt.indexOf("yyyy") != -1) ? srcfmt.indexOf("yyyy") : srcfmt.indexOf("yy"); + + if ((srcfmt == "dd/mm/yyyy" && !kony.os.isvaliddate(inputDate, srcfmt)) || datePos == -1 || monthPos == -1 || yearPos == -1 || srcfmt.indexOf("ddd") != -1 || srcfmt.indexOf("mmm") != -1) { + return null; + } + + var dateStrSep = srcfmt.charAt(datePos - 1); + var dateEndSep = srcfmt.charAt(datePos + 2); + dateEndSep = (dateEndSep == "(") ? "" : dateEndSep; + + var monthStrSep = srcfmt.charAt(monthPos - 1); + var monthEndSep = srcfmt.charAt(monthPos + 2); + + var yearStrSep = srcfmt.charAt(yearPos - 1); + var yearEndSep = srcfmt.charAt(yearPos + 4); + + var startDateIndex = (dateStrSep == "") ? inputDate.indexOf(dateStrSep, datePos - 1) : inputDate.indexOf(dateStrSep, datePos - 2) + 1; + var startMonthIndex = (monthStrSep == "") ? inputDate.indexOf(monthStrSep, monthPos - 1) : inputDate.indexOf(monthStrSep, monthPos - 2) + 1; + var startYearIndex = (yearStrSep == "") ? inputDate.indexOf(yearStrSep, yearPos - 1) : ((inputDate.indexOf(yearStrSep, yearPos - 2) != -1) ? inputDate.indexOf(yearStrSep, yearPos - 2) + 1 : inputDate.indexOf(yearStrSep, yearPos - 4) + 1); + + var endDateIndex = (dateEndSep != "") ? inputDate.indexOf(dateEndSep, datePos) : inputDate.indexOf(dateEndSep, datePos + 2); + var endMonthIndex = (monthEndSep != "") ? inputDate.indexOf(monthEndSep, monthPos) : inputDate.indexOf(monthEndSep, monthPos + 2); + var endYearIndex = (yearEndSep != "") ? inputDate.indexOf(yearEndSep, yearPos) : inputDate.indexOf(yearEndSep, yearPos + 4); + + var dateVal = inputDate.substring(startDateIndex, endDateIndex); + var monthVal = inputDate.substring(startMonthIndex, endMonthIndex); + var yearVal = inputDate.substring(startYearIndex, endYearIndex); + + if ((yearVal.length == 2 && targetfmt.indexOf("yyyy") != -1)) + var fullyr = new Date().getFullYear().toString().substr(0, 2) + yearVal; + + targetfmt = targetfmt.replace(/dd/, kony.os.padZero(parseInt(dateVal,10))); + targetfmt = targetfmt.replace(/mm/, kony.os.padZero(parseInt(monthVal,10))); + targetfmt = targetfmt.replace(/(yyyy|yy)/, fullyr ? fullyr : ((targetfmt.indexOf("yyyy") == -1 && yearVal.length == 4) ? yearVal.substr(2, 2) : yearVal)); + + return targetfmt; + } + return null; + }; +/**@Deprecated This API returns the various date components of a specified date (in a specified format) or the current system date.*/ + //os.isvaliddate(date,format) + kony.os.isValidDate = function (date, frmt) { + return (arguments.length != 2 || date == null || frmt == null) ? false :kony.os.isvaliddate(date, frmt); + }; +/**@Deprecated This API returns the various date components of a specified date (in a specified format) or the current system date.*/ + //os.dateComponents(date, format); + //Formats supported: (dd/mm/yyyy , mm/dd/yyyy, dd/mm/yy , mm/dd/yy) + kony.os.dateComponents = function (date,frmt){ + + var result; + var dateObject; + if (arguments.length == 0) { + dateObject = new Date(); + } + else if (date != null && frmt != null) { + if(!kony.os.isvaliddate(date,frmt)) + return null; + dateObject = kony.os.getDate(date, frmt); + var yearfmt = frmt.split("/")[2]; + } + if (dateObject) { + + var day = dateObject.getDate(); + var mon = dateObject.getMonth() + 1; + var year = (yearfmt && yearfmt.length == 2) ? parseInt(dateObject.getFullYear().toString().substr(2,2)) : dateObject.getFullYear(); + + result = new Object(); + result["year"] = year; + result["month"] = mon; + result["day"] = day; + result["hour"] = dateObject.getHours(); + result["min"] = dateObject.getMinutes(); + result["sec"] = dateObject.getSeconds(); + result["wday"] = dateObject.getDay() + 1; + result["yday"] = kony.os.getDayOfYear(day, mon, year); + result["isdst"] = kony.os.checkForDst(); + return result; + } + else + return null; + + }; + + kony.os.padZero = function (num) { + return num < 10 ? ("0"+num) : num; + }; +/**@Deprecated This API converts a given date string to the target format and returns the formatted date. Format will use the tokens dd,mm,yyyy to indicate day, month, and year respectively. The delimiter used between the tokens can be any character. For example, dd/mm/yyyy and (dd)(mm)(yyyy) are valid inputs.*/ + kony.os.formatdate = function (fmt, dateObj) { + fmt = fmt.toLowerCase(); + fmt = fmt.replace(/dd/, kony.os.padZero(dateObj.getDate())); + fmt = fmt.replace(/mm/, kony.os.padZero(dateObj.getMonth() + 1)); + return fmt.replace(/(yyyy|yy)/, fmt.indexOf("yyyy") == -1 ? dateObj.getFullYear().toString().substr(2, 2) : dateObj.getFullYear()); + }; +/**@Deprecated This API returns the various date components of a specified date (in a specified format) or the current system date.*/ + //Valid formats mm/dd/yy and mm/dd/yyyy and dd/mm/yyyy + kony.os.isvaliddate = function(dtStr, format){ + var minYear = 1900; + var maxYear = 2100; + var dtCh = "/"; + var daysInMonth = kony.os.daysArray(12); + + var pos1 = dtStr.indexOf(dtCh) + var pos2 = dtStr.indexOf(dtCh, pos1 + 1) + var dateFormat = format || "dd/mm/yyyy"; + + if (dateFormat == "dd/mm/yyyy" || dateFormat == "dd/mm/yy") { + var strDay = dtStr.substring(0, pos1) + var strMonth = dtStr.substring(pos1 + 1, pos2) + } + else + if (dateFormat == "mm/dd/yy" || dateFormat == "mm/dd/yyyy") { + var strDay = dtStr.substring(pos1 + 1, pos2); + var strMonth = dtStr.substring(0, pos1); + } + else + return false; + + var strYear = dtStr.substring(pos2 + 1); + /*if(strYear.length == 2 && dateFormat.indexOf("yyyy") != -1) + return false;*/ + var today = new Date(); + + strYr = strYear + if (strDay.charAt(0) == "0" && strDay.length > 1) + strDay = strDay.substring(1) + if (strMonth.charAt(0) == "0" && strMonth.length > 1) + strMonth = strMonth.substring(1) + if (strYr.length == 2) { + strYr = (today.getFullYear() + "").substr(0, 2) + strYr; + } + for (var i = 1; i <= 3; i++) { + if (strYr.charAt(0) == "0" && strYr.length > 1) + strYr = strYr.substring(1) + } + month = parseInt(strMonth) + day = parseInt(strDay) + year = parseInt(strYr) + + if (!kony.os.isInteger(strMonth) || !kony.os.isInteger(strDay) || !kony.os.isInteger(strYear) || strMonth.length < 1 || month < 1 || month > 12 || strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day > kony.os.daysInFebruary(year)) || day > daysInMonth[month] || strYr.length != 4 || year == 0 || year < minYear || year > maxYear) { + //alert("invalid date"); + return false + } + return true + }; + + kony.os.daysArray = function(n){ + for (var i = 1; i <= n; i++) { + this[i] = 31 + if (i == 4 || i == 6 || i == 9 || i == 11) { + this[i] = 30 + } + if (i == 2) { + this[i] = 29 + } + } + return this + }; + + kony.os.daysInFebruary = function(year){ + // February has 29 days in any year evenly divisible by four, + // EXCEPT for centurial years which are not also divisible by 400. + return (((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28); + }; + + kony.os.isInteger = function(s){ + var i; + for (i = 0; i < s.length; i++) { + // Check that current character is number. + var c = s.charAt(i); + if (((c < "0") || (c > "9"))) + return false; + } + // All characters are numbers. + return true; + }; + + kony.os.getDate = function(date, format){ + var dateObj; + if (typeof date === "string" && typeof format === "string") { + var dateParts = date.split("/"); + var yr = new Date().getFullYear().toString().substr(0, 2); + if (format.indexOf("yyyy") == -1 || dateParts[2].length == 2) + dateParts[2] = yr + dateParts[2]; + + if (format == "mm/dd/yyyy" || format == "mm/dd/yy") + dateObj = new Date(dateParts[0] + "/" + dateParts[1] + "/" + dateParts[2]); + else + dateObj = new Date(dateParts[1] + "/" + dateParts[0] + "/" + dateParts[2]); + + return dateObj; + } + }; + + kony.os.getDayOfYear = function(day, month, year){ + var i, j; + var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + + if (0 === year % 4) { + days[1]++; + } + + for (i = 1, j = 0; i < month; j += days[i - 1], i++) + ; + + return j + day; + }; + + kony.os.checkForDst = function(){ + + var rightNow = new Date(); + var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0); + var temp = jan1.toGMTString(); + var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ") - 1)); + var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60); + + var june1 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0); + temp = june1.toGMTString(); + var june2 = new Date(temp.substring(0, temp.lastIndexOf(" ") - 1)); + var daylight_time_offset = (june1 - june2) / (1000 * 60 * 60); + var dst; + if (std_time_offset == daylight_time_offset) { + //dst = "0"; // daylight savings time is NOT observed + return false; + } + else { + //dst = "1"; // daylight savings time is observed + return true; + } + }; + + + + diff --git a/SegementAnimation/modules/mbaasconfig.js b/SegementAnimation/modules/mbaasconfig.js new file mode 100644 index 0000000..8de8c4b --- /dev/null +++ b/SegementAnimation/modules/mbaasconfig.js @@ -0,0 +1,9 @@ +function getKonyMBAASAppKey() +{ + return $appKey; +} + +function getKonyMBAASAppSecret() +{ + return $appSecret; +} diff --git a/SegementAnimation/modules/onRowDisplayAnimation.js b/SegementAnimation/modules/onRowDisplayAnimation.js new file mode 100644 index 0000000..a4d68eb --- /dev/null +++ b/SegementAnimation/modules/onRowDisplayAnimation.js @@ -0,0 +1,428 @@ +function onRowDisplayFunction(){ + var animConfig = {"duration":0.3,"iterationCount":1,"delay":0,"fillMode":kony.anim.FORWARDS }; + //scale + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.scale(0.5,0.5); + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.scale(0.75,0.75); + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.scale(1,1); + var animDefinitionOne = {0 : {"anchorPoint":{"x":0.5,"y":0.5},"transform":transformProp1}, + 50 : {"anchorPoint":{"x":0.5,"y":0.5},"transform":transformProp2}, + 100 : {"anchorPoint":{"x":0.5,"y":0.5},"transform":transformProp3} + } ; + var animDefinition = kony.ui.createAnimation(animDefinitionOne); + var finalAnimation = {definition: animDefinition, config: animConfig}; +frmHome.segmentRestaurentList.setAnimations({ + visible: finalAnimation + + }); +//alert("setting onRowDisplay"); + //frmHome.segmentRestaurentList.onRowDisplay=onRowDispListener; + kony.print("In row display"); +//frmName.segMain.onRowDisplay = onRowDispListener; +} +function onRowDispListener(widget, state, currentRowContext, startRowContext, endRowContext) +{ + //alert + alert("\nonRowDispListener2"); +} +function onRowDispListener2(widget, state, currentRowContext, startRowContext, endRowContext) +{ + kony.print("\nwidget: " + widget); + kony.print("\nstate: " + state); + kony.print("\ncurrentRow: " + currentRowContext + " \nsartRow: " + startRowContext + " \nendRow: " + endRowContext); + var animConfig = {"duration":0.1,"iterationCount":1,"delay":0,"fillMode":kony.anim.FILL_MODE_BOTH }; + //scale + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.scale(0.5,0.5); + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.scale(0.75,0.75); + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.scale(1,1); + var animDefinitionOne = {0 : {"anchorPoint":{"x":0.5,"y":0.5},"transform":transformProp1}, + 50 : {"anchorPoint":{"x":0.5,"y":0.5},"transform":transformProp2}, + 100 : {"anchorPoint":{"x":0.5,"y":0.5},"transform":transformProp3} + } ; + var animDefinition = kony.ui.createAnimation(animDefinitionOne); + var finalAnimation = {definition: animDefinition, config: animConfig}; + var RI=0; + var animContext=[]; + // var firstVisibleRow=(frmHome.Seg1.getFirstVisibleRow())[rowIndex]; + // var lastVisibleRow=(frmHome.Seg1.getLastVisibleRow())[rowIndex]; + // kony.print("first row:-"+firstVisibleRow); + // kony.print("last row:-"+lastVisibleRow); + /* for(var i=firstVisibleRow;i>0;i--){ + animContext.push({sectionIndex:0,rowIndex : i}); + }*/ + var i=startRowContext["rowIndex"]; + var j=endRowContext["rowIndex"]; + kony.print("last row:-"+j); + i--; + for(;i>=0;i--){ + animContext.push({sectionIndex:0,rowIndex : i}); + } + for(;j<14;j++){ + animContext.push({sectionIndex:0,rowIndex : j}); + } + //var contextDef={sectionIndex:0,rowIndex : 1}; + //var animContext = [contextDef]; + switch (state) { + case kony.segment.ADD: + //alert("ADD"); + widget.animateRows({context: animContext, animation: finalAnimation}); + break; + case kony.segment.UPDATE: + //alert("UPDATE"); + widget.animateRows({context: animContext, animation: finalAnimation}); + break; + case kony.segment.REMOVE: + //alert("REMOVE"); + widget.animateRows({context: animContext, animation: finalAnimation}); + break; + case kony.segment.VISIBLE: + // alert("VISIBLE"); + widget.animateRows({context: animContext, animation: finalAnimation}); + break; + default :break; + } +} +/* +function getTestOperation(){ + + animationType = segForm.lbAnimationType.selectedKey; + Operation = segForm.lbOperation.selectedKey; + Mode = segForm.lbMode.selectedKey; + widToAnimate = segForm.lbWidget.selectedKey; + + + + + frmTest.lblInfo.text = " FormType" + frmHome.lbFormType.selectedKeyValue+ + "| segContainertype" + frmHome.lbSegCont.selectedKeyValue+ + "| segRowTemplateType" + frmHome.lbRowTemplate.selectedKeyValue + + "| widgetType" + frmHome.lbWidgets.selectedKeyValue+ + "| SegmentType" + frmHome.lbSegmentType.selectedKeyValue+ + "| dataType" + frmHome.lbData.selectedKeyValue + + "| animationType" + segForm.lbAnimationType.selectedKeyValue + + "| Operation" + segForm.lbOperation.selectedKeyValue + + "| Mode" + segForm.lbMode.selectedKeyValue + + "| Widget" + segForm.lbWidget.selectedKeyValue; + +} +function getMode(){ + switch(Mode){ + case "1" : animMode=kony.anim.FILL_MODE_FORWARDS; + break; + case "2" : animMode=kony.anim.FILL_MODE_BACKWARDS + break; + case "3" : animMode=kony.anim.FILL_MODE_BOTH + break; + default : animMode=kony.anim.FILL_MODE_BACKWARDS + break; + } + return animMode; +} +function getFinalAnimation(){ + + animConfig = { + "duration":4, + "iterationCount":1, + "delay":0, + "fillMode":getMode() + }; + switch(animationType){ + + + + + case "2" : //rotate + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.rotate(90); + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.rotate(90); + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.rotate(180); + var animDefinitionOne = + { + 0 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp1 + }, + 50 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp2 + }, + 100 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp3 + } + } + + + break; + case "3" : //scale + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.scale(0.5,0.5); + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.scale(1,1); + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.scale(2,2); + var animDefinitionOne = + { + 0 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp1 + }, + 50 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp2 + }, + 100 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp3 + } + } + + + break; + case "4" : //translate-Scale + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.translate(10,10); + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.translate(20,20); + transformProp2.scale(0.5,0.5); + + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.translate(80,80); + transformProp3.scale(2,2); + var animDefinitionOne = + { + 0 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp1 + }, + 50 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp2 + }, + 100 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp3 + } + } + + + break; + case "5" : //Scale-Rotate + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.rotate(90); + + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.rotate(90); + transformProp2.scale(0.5,0.5); + + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.rotate(180); + transformProp3.scale(2,2); + var animDefinitionOne = + { + 0 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp1 + }, + 50 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp2 + }, + 100 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp3 + } + } + + + break; + case "6" : //Translate-Rotate + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.rotate(90); + + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.rotate(90); + transformProp2.translate(10,10); + + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.translate(20,20); + transformProp3.rotate(180); + var animDefinitionOne = + { + 0 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp1 + }, + 50 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp2 + }, + 100 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp3 + } + } + + + break; + case "7" : //Translate-Rotate-Scale + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.scale(0.5,0.5); + + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.rotate(90); + transformProp2.translate(10,10); + + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.translate(20,20); + transformProp3.scale(2,2); + transformProp3.rotate(180); + var animDefinitionOne = + { + 0 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp1 + }, + 50 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp2 + }, + 100 : + { + "anchorPoint":{"x":0.5,"y":0.5}, + "transform":transformProp3 + } + } + + + break; + + case "8" : //Opacity Background Color + var animDefinitionOne = + { + 0 : + { + "opacity":0 + }, + 50 : + { "backgroundColor":"0000ff", + "opacity":0.5 + }, + 100 : + { + "backgroundColor":"ff0000", + "opacity":1 + } + } + break; + + case "9" : //Opacity + var animDefinitionOne = + { + 0 : + { + "opacity":0 + }, + 50 : + { + "opacity":0.5 + }, + 100 : + { + "opacity":1.5 + } + } + break; + case "10" : //BackgroundColor + var animDefinitionOne = + { + 0 : + { + "backgroundColor":"ff00ff" + }, + 50 : + { + "backgroundColor":"ff00ff" + }, + 100 : + { + "backgroundColor":"ff0000" + } + } + break; + case "1": //translate + default : //translate + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.translate(10,10); + var transformProp2 = kony.ui.makeAffineTransform(); + transformProp2.translate(20,20); + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.translate(30,30); + var animDefinitionOne = + { + 0 : + { + "anchorPoint":{"x":1,"y":1}, + "transform":transformProp1 + }, + 50 : + { + "anchorPoint":{"x":1,"y":1}, + "transform":transformProp2 + }, + 100 : + { + "anchorPoint":{"x":1,"y":1}, + "transform":transformProp3 + } + } + + + + break; + } // switch case complete + + + //function onAnimStart(){ +// alert("animation start!"); +// } +// +// function onAnimEnd(){ +// alert("animation end!"); +// } +// +// animCallBack = { +// animationStart: onAnimStart, +// animationEnd: onAnimEnd +// } + animDefinition = kony.ui.createAnimation(animDefinitionOne); + + finalAnimation = {definition: animDefinition, config: animConfig} //, callbacks: animCallBack}; + return finalAnimation; + + +}*/ \ No newline at end of file diff --git a/SegementAnimation/modules/restaurentModules.js b/SegementAnimation/modules/restaurentModules.js new file mode 100644 index 0000000..675e0f8 --- /dev/null +++ b/SegementAnimation/modules/restaurentModules.js @@ -0,0 +1,241 @@ +var favList=[]; +var lastPos=0; +var lastSwipedRow=null; +function moreOptions(){ + alert("WIP"); +} +function removeFromFavList(){ + alert("WIP"); +} +function showRestaurentDetails1(){ + var index=frmHome.segmentRestaurentList.selectedRowIndex[1]; + kony.print("selected Row:- "+index); + // if(favList.indexOf(index)==-1){ + //favList.push(index); + frmDetails.lblResName.text=response["results"][index]["name"]; + frmDetails.lblRating.text=response["results"][index]["rating"]; + frmDetails.lblAddress.text=response["results"][index]["vicinity"]; + frmDetails.show(); + // } +} +function markAsFavouriteRestaurent(){ + + var index=frmHome.segmentRestaurentList.selectedRowIndex[1]; + kony.print("selected Row:- "+index); + if(favList.indexOf(index)==-1){ + // kony.application.showLoadingScreen("sknLoading","",constants.LOADING_SCREEN_POSITION_ONLY_CENTER, true, true,null); + favList.push(index); + // kony.application.dismissLoadingScreen(); + }else return; +} + + +function setFavoriteRestaurent1(){ + // kony.store.getItem() + // setGestureRecogniserToFrmfav(); + var resObj={}; + var favresList=[]; + for(var i=0;iL Bella Pizzeria Restaurant" + ], + "photo_reference": "CmRdAAAAV8d8CJHs1ofhvjTmx-eq8mmegNSzCNuk0s3lYYa9wcPk5xK3KQ6_Oqfoij4GznTRur521DbXSWFby3UkoilS3_O0bZO9oPGfxrtC3L9EoUJgD9kyQFXigwJLlqwJ4EpcEhD-mTWkyFdTChyw1kkjXiJRGhQb1ArU1VITG2VJv8O4DTs_YZ29qA", + "width": 2048 + } + ], + "place_id": "ChIJm5mnKIpgwokRwd7wC1E33BQ", + "price_level": 2, + "rating": 4.2, + "reference": "CnRuAAAA2n7-KqKMm_nJY5ugxL0mj7f9hl1UQLtp5TpkplsBRMUrwc17u-w3ARowOuu_p1DasqTRTFF1E6P9Q1Yh5i2h4RDWh7Yp3oaPeLYsC7FiktUM0M0krzkn76ElvAaECCvwH-6-THhY0wKLzhPPGlGDaRIQg-D-UNQG98XYXRmYoV_GURoU6Jjv8rdA8tUW_cFPFPusuZHiREs", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "69-26 Main Street, Flushing" + }, + { + "geometry": { + "location": { + "lat": 40.733704, + "lng": -73.825498 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "856a3d0e0e0341f9f6f953bfb3261159372d3d13", + "name": "Ching Hing House", + "place_id": "ChIJfxjXFWJgwokRXLklDNHY4s8", + "reference": "CnRkAAAA6JUhYjv_vacE46WPtcDiuNZ3jaHpMEqYuWlSAg-sNNjb7AMnnZxfLQpmWO2U6vOXSn9vDv0QFi-xQQQnKBM3cQC9wDwgpq_Dx6kSqGNRgwQxlTZVo_G43l8L_GY1Pm-w4kTmg-DlxexnQrn_0e2nWRIQ8WdH35pUy4eOL_DpLoGlkxoUpbDx88aD0shtJMH4X5hPZjVam3w", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "6822 Main Street, Flushing" + }, + { + "geometry": { + "location": { + "lat": 40.733521, + "lng": -73.82491 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "b081252d002dbfc07667850646214d275d3b84db", + "name": "Main Bakhtar", + "opening_hours": { + "open_now": false, + "weekday_text": [ + + ] + }, + "place_id": "ChIJoZ_-PWJgwokR4pm3C5XJ3V4", + "price_level": 1, + "rating": 3.9, + "reference": "CmRfAAAAQHsItZzjBEEbn5RFPPQI9jCFYW91IpWIYsCFSE7ND5IViiWxggJEXO5o7e_NhVa7bHClearA5SzHfDhXIxnyvBr1ECV3J0zdeF6ZoGntcIWt3WnUoDQBQsTO1YBdV_LkEhBJRHu3oOvMqvOoS96u6_YgGhS3cpm4v9-Dwlhr2VaZ28qRwK4NtQ", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "6729 Main Street, Flushing" + }, + { + "geometry": { + "location": { + "lat": 40.733852, + "lng": -73.825114 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "9a93d40cef87a5704a6dc655afcdb6c377b3b27b", + "name": "Mechy’s Deli", + "opening_hours": { + "open_now": false, + "weekday_text": [ + + ] + }, + "photos": [ + { + "height": 297, + "html_attributions": [ + "Mechy’s Deli" + ], + "photo_reference": "CmRdAAAA7QfnzMwdbvT_ihWtNLTf5a5_VaooE8p5hiX6fYRT9GOXNmnclT7feZgrQ1DMIAIcEp-lp6v8ewdNeH7YmrW67LP8KrYxfhQPlxaWDIbZKWsST2gn7H_QYgIF03SukKZwEhB7_vTxOSio3XjiDc4K950WGhRr_VFWdqxlWWF4EXevdL6s6lXNAQ", + "width": 317 + } + ], + "place_id": "ChIJcwHgFWJgwokRgqafJZf0phA", + "reference": "CnRhAAAAG6oJUbfZthb8ZkH2XpPnclXZ6OmG1NeOchOmk1qa_ot7CXyYORYS42x0se2jjepoV1-TSGKjnqMYCpLn9sosi8D7u8vaTjkWxp-NXhkvxy4UhAbxx3oKhzNp7trfXXG5tH9EKoqaYYJv7ZWYzMFnkBIQlaF6is0A8xQVMBsdZbsevBoUFtudwsGEP9gz66IuIgMQKkaqB3A", + "scope": "GOOGLE", + "types": [ + "meal_takeaway", + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "68-18 Main Street, Flushing" + }, + { + "geometry": { + "location": { + "lat": 40.73002, + "lng": -73.823897 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "5c05848f3d01e9748fb5c5a0a4a21c9bdd47cb1f", + "name": "Hibachi express", + "opening_hours": { + "open_now": false, + "weekday_text": [ + + ] + }, + "place_id": "ChIJx_lhK4pgwokRUOE0AZrTWZE", + "reference": "CnRjAAAAKA-O1gVY7q11Yzm0C3STQ7XOfNeef0Z-S-HXbUc5vqPMwn4sh4Lflm2qyRNOeBoO73N8op9rzpRfMx_PY9jiL-UKX2vIzpQ9KhcFZACSEhLTy88nkV4JHtSwGjaNb0S8d8-DcGG_stSOL7aUyRz7YBIQ_nG76JVB3AUy5PuvjZomGhoUeWhkmSXWMuOIWtnCju2eiwyz02Y", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "141-25 Jewel Avenue, New York" + }, + { + "geometry": { + "location": { + "lat": 40.733687, + "lng": -73.825051 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "9932363fcdf1bb96b1f9ab9e4ff23e9ab6f91b71", + "name": "Sushi Tokyo", + "opening_hours": { + "open_now": false, + "weekday_text": [ + + ] + }, + "photos": [ + { + "height": 2576, + "html_attributions": [ + "Sushi Tokyo" + ], + "photo_reference": "CmRdAAAAPGVdmEhdqz8YYH-aeV02Gc-YrfZdwFuxEKuTLZokCImihj9doNVGSuED5jQfL9N1K6YpgQZtqI8zgAn9BZAHX8TudctqS4mHlQuAIdQb4aa69WkYYI2MgZ_N4NsUKYyzEhANVERiK1Fxjq_KnGeBvMwQGhRRGUWfZrXCqFcM1BtqllKH2Zt32Q", + "width": 3484 + } + ], + "place_id": "ChIJcU6QF2JgwokRBM92COYIZtE", + "rating": 4.6, + "reference": "CmRfAAAAeZeLM-dbphF4NSrSfEc10lKBoPYdI-qQYKq1EC7httoO2TATrV5rCq_ZjYs5MIc8GKqCYPQPnFTqHi0Bwp7Xwtd05HCxZISFOOcEkd8N4ypm2Ovdy1eGlcuTWo776dLbEhAunHz3mVhX9SqMMkw9VUF4GhRmM1TnLFRNntejEsUfN2x3LqS5bw", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "67-25 Main Street, Flushing" + }, + { + "geometry": { + "location": { + "lat": 40.729671, + "lng": -73.823526 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "43a1eeb87f3038a9a54e55533d734697cca2b26d", + "name": "N Brand 26 Llc", + "place_id": "ChIJQ_opzItgwokRtMPzxCslmoc", + "reference": "CnRiAAAAk9RIZe_1kyyCxpbSWBVOfqj6r0afnjCNwrz4ak9nvUXBjMC6p6Quu8ozqZnvTCe_jyhhdSn-sZS0oGHwEZwzgUZmuZFaX3sxD3I08NdWjPZLYdnZ_XvggzERSkzx6KJ3umr9QQnpRYEWqLnsdex7aRIQBGcEuOF6GCeISbDT0nCP2RoU4y5whMH34jhd2e9NAUFyJ1ZIDdU", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "6962 Main Street, Flushing" + }, + { + "geometry": { + "location": { + "lat": 40.728699, + "lng": -73.82381 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "bfd0b691cd8c636667b4413b4d7dfb80befd5ad8", + "name": "pizza4u", + "place_id": "ChIJs2jz3YtgwokRR3omCL7oSVw", + "reference": "CmRaAAAAETMSNiQqt307uKu51iErJIDNPL1xJbQTQplaTc0gnaL9lvrEpYheLnCclSV2j4pBNHHA4rlAqRvXSdx5aGFFj3hGgACie0k3Ru7MftIHXUBRKnWrSH2YyikOeukZbyBWEhDeN9bPIXd_Y08Yk7vlyzemGhQ-Gm1UzZWn3DwlykfxCS-Ge-IUeQ", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "141-25 70th Road, New York" + }, + { + "geometry": { + "location": { + "lat": 40.730192, + "lng": -73.823824 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "a062946f788c831bb1be93abca04398bbe1c970b", + "name": "Bedford kitchen", + "photos": [ + { + "height": 683, + "html_attributions": [ + "Bedford kitchen" + ], + "photo_reference": "CmRdAAAAb6HdVVvYA1MV5HfzaTUQvSrsTfwIBx2yzzUVR97JGPcGyXZgOPpzdQ2P9kaJJUqkUD2mhbypP40__dD4MPuBLD7XObopbpeQ1mzRuDRAIzbnuBfWLI0C_8zCHBpzzSwrEhADPaitSTlZbuqVI_Xa1JM-GhTa-PfmCSn9vV7HMSKmS8qAsgXz1A", + "width": 1024 + } + ], + "place_id": "ChIJJ4QZLIpgwokRCWY6L8sC3zQ", + "reference": "CnRiAAAABL4Mq2qbdngszS2ccdeXr4-_LdMQforY1aQ1MWHpDyqEIAfROCgd0zS-ydSBkAKO-rRcAUDkECbo-Vo1WmCxWg1QW3G0PcFBTFcEfLgR3LDAdL3xQk4F3ehMRfpij64riEEXkVc_pcl3ZGK6YFSE8RIQ-3Q3XpCuosL0zsB6SOrjbhoUBevQXHSio-y1Mus_80cZVxxkgKo", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "69-42 Main Street, New York" + }, + { + "geometry": { + "location": { + "lat": 40.733715, + "lng": -73.825394 + } + }, + "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", + "id": "4bd5b2d16717d9e1c124af4343db8c83dd5c2442", + "name": "SOYSAUCE Glatt Kosher Chinese Take-out", + "opening_hours": { + "open_now": false, + "weekday_text": [ + + ] + }, + "photos": [ + { + "height": 833, + "html_attributions": [ + "SOYSAUCE Glatt Kosher Chinese Take-out" + ], + "photo_reference": "CmRdAAAActxxJgly7eZAKLs5LIWyZvqDrk4H6ia5muMFQnFIB5sj-In5i3LTfLmm6HNO5lZ6HJUsnetTEYr57fdccsswinSakx-BGpQ_YswmcYdqSWSe82SOil70n-k6VsWumfZAEhC4pPPCDrBWX284LFrnK5TiGhT_BAsap-q7Try-ot_ZnJ9rylYGsw", + "width": 1875 + } + ], + "place_id": "ChIJDxfRFWJgwokR0Rv2HVFpcmQ", + "reference": "CoQBeQAAAErA2N2qet1eJ8qS60n74vUQXb689mJgDaLHATWeS08fNGIULj41y-e1geDqWA90z_QVdFHRfPaR9kb9vkkRQMhGehMxubxJpLywF8SrdQtFAjEzuI-0CHLHKQD-PToIjseIFPhCKYqhs5FtDr51Mw4iiOcazKe2YCHVjtKWWIYqEhB_hWqlYskxd-YrcEUC8Fb4GhQOpkQhbYMKc7fs3PvpV84OO_OYqg", + "scope": "GOOGLE", + "types": [ + "restaurant", + "food", + "point_of_interest", + "establishment" + ], + "vicinity": "68-22 Main Street, Flushing" + } + ], + "status": "OK" +}; + +}*/ + + + + diff --git a/SegementAnimation/modules/segmentCallBackModules.js b/SegementAnimation/modules/segmentCallBackModules.js new file mode 100644 index 0000000..d043ce8 --- /dev/null +++ b/SegementAnimation/modules/segmentCallBackModules.js @@ -0,0 +1,23 @@ +function setDeleteButtonCallBack(){ + FlexContainerFavorite.FlexContainerDeleteBtn.onClick = flx_onclick; +} + + function flx_onclick(widget, context){ + var sectionIndex = context["sectionIndex"]; + var rowIndex = parseInt(context["rowIndex"]); + var seg = context["widgetInfo"]; + //alert(rowIndex); + var transformProp1 = kony.ui.makeAffineTransform(); + transformProp1.scale(1,0); + + var transformProp3 = kony.ui.makeAffineTransform(); + transformProp3.scale(1,1); + var animDefinitionOne = {0 : {"transform":transformProp3}, + 100 : {"transform":transformProp1}}; + + var animDefinition = kony.ui.createAnimation(animDefinitionOne); + var animConfig = {"duration":0.3,"iterationCount":1,"delay":0,"fillMode":kony.anim.FORWARDS }; + var finalAnimation = {definition: animDefinition, config: animConfig}; + // kony.print("\nrow index:-"+parseInt(rowIndex)); + frmFavorite.segFavRestaurents.removeAt(rowIndex, 0, finalAnimation); +} \ No newline at end of file diff --git a/SegementAnimation/projectProperties.json b/SegementAnimation/projectProperties.json new file mode 100644 index 0000000..309139e --- /dev/null +++ b/SegementAnimation/projectProperties.json @@ -0,0 +1,173 @@ +{ + "mwaddrkey": "", + "wap_android360_fontsize": "12", + "isA11yConfigEnabled": false, + "wap_android440_fontsize": "12", + "apppackagekey": "", + "wap_android400_fontsize": "12", + "wap_spaandroidtabhdpi_fontsize": "12", + "watchos_shortlooknotificationicon": "", + "appversionkey": "1.0.0", + "project.type": "js", + "startupformkey": "frmLogin", + "wap_bb480_fontsize": "12", + "wap_winphone480_fontsize": "12", + "wap_android640_fontsize": "12", + "vendornamekey": "KonyLabs", + "wap_android320_fontsize": "12", + "createdgaversion": "6.8.0", + "wap_android480_fontsize": "12", + "wap_winphone320_fontsize": "12", + "appmenu": { + "tablet": { + "data": [ + { + "kuid": "6b2c1ed9c1d54ad8abfd0e256484c6ab", + "icon": { + "default": "option1.png" + }, + "id": "appmenuitemid1", + "title": "Item 1" + }, + { + "kuid": "cd4d00e1989644fc977f0cc4ad0c15c2", + "icon": { + "default": "option2.png" + }, + "id": "appmenuitemid2", + "title": "Item 2" + }, + { + "kuid": "ff297904b7494cd09ccec118cda1cac4", + "icon": { + "default": "option3.png" + }, + "id": "appmenuitemid3", + "title": "Item 3" + }, + { + "kuid": "199d055f217d4c278448e87fd4ab52b0", + "icon": { + "default": "option4.png" + }, + "id": "appmenuitemid4", + "title": "Item 4" + } + ] + }, + "desktop": { + "data": [ + { + "kuid": "bba48be55eb84c16846c58a603930fbd", + "icon": { + "default": "option1.png" + }, + "id": "appmenuitemid1", + "title": "Item 1" + }, + { + "kuid": "2e4c09d471ce49e284e61a10f0a76f02", + "icon": { + "default": "option2.png" + }, + "id": "appmenuitemid2", + "title": "Item 2" + }, + { + "kuid": "8eadda80db04494486416d31fab05cda", + "icon": { + "default": "option3.png" + }, + "id": "appmenuitemid3", + "title": "Item 3" + }, + { + "kuid": "ad20211edcc84e2ca7821b7c1889abd7", + "icon": { + "default": "option4.png" + }, + "id": "appmenuitemid4", + "title": "Item 4" + } + ] + }, + "focusskin": null, + "osVersion": "iOS7", + "wType": "Appmenu", + "focusSkin": null, + "mobile": { + "data": [ + { + "kuid": "d396a64e47b543058288a62ea52afec1", + "icon": { + "default": "option1.png" + }, + "id": "appmenuitemid1", + "title": "Item 1" + }, + { + "kuid": "7d1d958c0e3846db8e6ec2fdfe2fd159", + "icon": { + "default": "option2.png" + }, + "id": "appmenuitemid2", + "title": "Item 2" + }, + { + "kuid": "22446f493e214a86b27f1a7c3863913d", + "icon": { + "default": "option3.png" + }, + "id": "appmenuitemid3", + "title": "Item 3" + }, + { + "kuid": "bbd5753372364ffdb43d3e448540689b", + "icon": { + "default": "option4.png" + }, + "id": "appmenuitemid4", + "title": "Item 4" + } + ] + }, + "skin": null, + "osPlatform": "" + }, + "wap_spaipad_fontsize": "12", + "mwportkey": "", + "mwhttpsportkey": "", + "wap_bb440_fontsize": "12", + "wap_bb400_fontsize": "12", + "appidkey": "SegementAnimation", + "statusBarHidden": "false", + "wap_bb360_fontsize": "12", + "isNewAppWithRespectToAndroidPackageName": "", + "wap_spawindowstab_fontsize": "12", + "watchos_longlooknotificationicon": "", + "defaulttheme": "defaultTheme", + "appaddrkey": "", + "appnamekey": "SegementAnimation", + "watchos_notificationcentericon": "", + "currentgaversion": "6.8.0", + "wap_bb320_fontsize": "12", + "wap_bb240_fontsize": "12", + "desktopwebbasefontsize": "12", + "wap_android240_fontsize": "12", + "wap_spaandroidtabldpi_fontsize": "12", + "wap_spaandroidtabmdpi_fontsize": "12", + "konyVizVersion": "2.9.0", + "wap_spaandroidtab_fontsize": "12", + "winmobileguidkey": "", + "APPLICATION_THEME": "default", + "ide_appEvents": { + "mobile": { + "postappinit": "AS_AppEvents_8a84016745d44ecba1d25abf940da40d" + } + }, + "build": "debug", + "watchos_homescreenicon": "", + "project_version": "sprint22", + "wap_ip_fontsize": "12", + "createdVizVersion": "2.8.0" +} \ No newline at end of file diff --git a/SegementAnimation/projectprop.xml b/SegementAnimation/projectprop.xml new file mode 100644 index 0000000..b03198f --- /dev/null +++ b/SegementAnimation/projectprop.xml @@ -0,0 +1,467 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SegementAnimation/projectsplash.xml b/SegementAnimation/projectsplash.xml new file mode 100644 index 0000000..85b87fa --- /dev/null +++ b/SegementAnimation/projectsplash.xml @@ -0,0 +1 @@ +10falsePortrait10false \ No newline at end of file diff --git a/SegementAnimation/resources/common/back.png b/SegementAnimation/resources/common/back.png new file mode 100644 index 0000000..5486e43 Binary files /dev/null and b/SegementAnimation/resources/common/back.png differ diff --git a/SegementAnimation/resources/common/calbtn.png b/SegementAnimation/resources/common/calbtn.png new file mode 100644 index 0000000..0722cc1 Binary files /dev/null and b/SegementAnimation/resources/common/calbtn.png differ diff --git a/SegementAnimation/resources/common/check_btn.png b/SegementAnimation/resources/common/check_btn.png new file mode 100644 index 0000000..80cc88d Binary files /dev/null and b/SegementAnimation/resources/common/check_btn.png differ diff --git a/SegementAnimation/resources/common/check_btn_f.png b/SegementAnimation/resources/common/check_btn_f.png new file mode 100644 index 0000000..0622e66 Binary files /dev/null and b/SegementAnimation/resources/common/check_btn_f.png differ diff --git a/SegementAnimation/resources/common/delete.png b/SegementAnimation/resources/common/delete.png new file mode 100644 index 0000000..6d1dc69 Binary files /dev/null and b/SegementAnimation/resources/common/delete.png differ diff --git a/SegementAnimation/resources/common/details_image.png b/SegementAnimation/resources/common/details_image.png new file mode 100644 index 0000000..86b8624 Binary files /dev/null and b/SegementAnimation/resources/common/details_image.png differ diff --git a/SegementAnimation/resources/common/fav_btn.png b/SegementAnimation/resources/common/fav_btn.png new file mode 100644 index 0000000..90abe29 Binary files /dev/null and b/SegementAnimation/resources/common/fav_btn.png differ diff --git a/SegementAnimation/resources/common/favorites.png b/SegementAnimation/resources/common/favorites.png new file mode 100644 index 0000000..85d12fa Binary files /dev/null and b/SegementAnimation/resources/common/favorites.png differ diff --git a/SegementAnimation/resources/common/imagedrag.png b/SegementAnimation/resources/common/imagedrag.png new file mode 100644 index 0000000..2b641f5 Binary files /dev/null and b/SegementAnimation/resources/common/imagedrag.png differ diff --git a/SegementAnimation/resources/common/img1.png b/SegementAnimation/resources/common/img1.png new file mode 100644 index 0000000..b4e6583 Binary files /dev/null and b/SegementAnimation/resources/common/img1.png differ diff --git a/SegementAnimation/resources/common/img2.png b/SegementAnimation/resources/common/img2.png new file mode 100644 index 0000000..6eaccd8 Binary files /dev/null and b/SegementAnimation/resources/common/img2.png differ diff --git a/SegementAnimation/resources/common/img3.png b/SegementAnimation/resources/common/img3.png new file mode 100644 index 0000000..9b43545 Binary files /dev/null and b/SegementAnimation/resources/common/img3.png differ diff --git a/SegementAnimation/resources/common/konyap.png b/SegementAnimation/resources/common/konyap.png new file mode 100644 index 0000000..783019e Binary files /dev/null and b/SegementAnimation/resources/common/konyap.png differ diff --git a/SegementAnimation/resources/common/login_pass_icon.png b/SegementAnimation/resources/common/login_pass_icon.png new file mode 100644 index 0000000..6ec986b Binary files /dev/null and b/SegementAnimation/resources/common/login_pass_icon.png differ diff --git a/SegementAnimation/resources/common/logo.png b/SegementAnimation/resources/common/logo.png new file mode 100644 index 0000000..d9e6f93 Binary files /dev/null and b/SegementAnimation/resources/common/logo.png differ diff --git a/SegementAnimation/resources/common/logout.png b/SegementAnimation/resources/common/logout.png new file mode 100644 index 0000000..a8b7554 Binary files /dev/null and b/SegementAnimation/resources/common/logout.png differ diff --git a/SegementAnimation/resources/common/map.png b/SegementAnimation/resources/common/map.png new file mode 100644 index 0000000..e088e5b Binary files /dev/null and b/SegementAnimation/resources/common/map.png differ diff --git a/SegementAnimation/resources/common/map_message_image.png b/SegementAnimation/resources/common/map_message_image.png new file mode 100644 index 0000000..3d8732d Binary files /dev/null and b/SegementAnimation/resources/common/map_message_image.png differ diff --git a/SegementAnimation/resources/common/map_pointer.png b/SegementAnimation/resources/common/map_pointer.png new file mode 100644 index 0000000..3907bf8 Binary files /dev/null and b/SegementAnimation/resources/common/map_pointer.png differ diff --git a/SegementAnimation/resources/common/more.png b/SegementAnimation/resources/common/more.png new file mode 100644 index 0000000..a3edbe2 Binary files /dev/null and b/SegementAnimation/resources/common/more.png differ diff --git a/SegementAnimation/resources/common/off.png b/SegementAnimation/resources/common/off.png new file mode 100644 index 0000000..7375ad0 Binary files /dev/null and b/SegementAnimation/resources/common/off.png differ diff --git a/SegementAnimation/resources/common/on.png b/SegementAnimation/resources/common/on.png new file mode 100644 index 0000000..bfcc3c2 Binary files /dev/null and b/SegementAnimation/resources/common/on.png differ diff --git a/SegementAnimation/resources/common/option1.png b/SegementAnimation/resources/common/option1.png new file mode 100644 index 0000000..5d84594 Binary files /dev/null and b/SegementAnimation/resources/common/option1.png differ diff --git a/SegementAnimation/resources/common/option2.png b/SegementAnimation/resources/common/option2.png new file mode 100644 index 0000000..232cd55 Binary files /dev/null and b/SegementAnimation/resources/common/option2.png differ diff --git a/SegementAnimation/resources/common/option3.png b/SegementAnimation/resources/common/option3.png new file mode 100644 index 0000000..8d91307 Binary files /dev/null and b/SegementAnimation/resources/common/option3.png differ diff --git a/SegementAnimation/resources/common/option4.png b/SegementAnimation/resources/common/option4.png new file mode 100644 index 0000000..6340f1a Binary files /dev/null and b/SegementAnimation/resources/common/option4.png differ diff --git a/SegementAnimation/resources/common/pageOffDot.png b/SegementAnimation/resources/common/pageOffDot.png new file mode 100644 index 0000000..9ff7668 Binary files /dev/null and b/SegementAnimation/resources/common/pageOffDot.png differ diff --git a/SegementAnimation/resources/common/pageOnDot.png b/SegementAnimation/resources/common/pageOnDot.png new file mode 100644 index 0000000..5841171 Binary files /dev/null and b/SegementAnimation/resources/common/pageOnDot.png differ diff --git a/SegementAnimation/resources/common/pinb.png b/SegementAnimation/resources/common/pinb.png new file mode 100644 index 0000000..0e57cf7 Binary files /dev/null and b/SegementAnimation/resources/common/pinb.png differ diff --git a/SegementAnimation/resources/common/rate_btn.png b/SegementAnimation/resources/common/rate_btn.png new file mode 100644 index 0000000..87cf304 Binary files /dev/null and b/SegementAnimation/resources/common/rate_btn.png differ diff --git a/SegementAnimation/resources/common/slider.png b/SegementAnimation/resources/common/slider.png new file mode 100644 index 0000000..9db6412 Binary files /dev/null and b/SegementAnimation/resources/common/slider.png differ diff --git a/SegementAnimation/resources/common/slider_android.png b/SegementAnimation/resources/common/slider_android.png new file mode 100644 index 0000000..8b3cfac Binary files /dev/null and b/SegementAnimation/resources/common/slider_android.png differ diff --git a/SegementAnimation/resources/common/slider_ios7.png b/SegementAnimation/resources/common/slider_ios7.png new file mode 100644 index 0000000..ea2eba7 Binary files /dev/null and b/SegementAnimation/resources/common/slider_ios7.png differ diff --git a/SegementAnimation/resources/common/splash.png b/SegementAnimation/resources/common/splash.png new file mode 100644 index 0000000..4781a59 Binary files /dev/null and b/SegementAnimation/resources/common/splash.png differ diff --git a/SegementAnimation/resources/common/user_icon.png b/SegementAnimation/resources/common/user_icon.png new file mode 100644 index 0000000..09191db Binary files /dev/null and b/SegementAnimation/resources/common/user_icon.png differ diff --git a/SegementAnimation/resources/common/zoomout.png b/SegementAnimation/resources/common/zoomout.png new file mode 100644 index 0000000..4702519 Binary files /dev/null and b/SegementAnimation/resources/common/zoomout.png differ diff --git a/SegementAnimation/resources/customwidgets/mappings/android/jsRichClientCustomWidget.xml b/SegementAnimation/resources/customwidgets/mappings/android/jsRichClientCustomWidget.xml new file mode 100644 index 0000000..e69de29 diff --git a/SegementAnimation/resources/desktop/common/close.png b/SegementAnimation/resources/desktop/common/close.png new file mode 100644 index 0000000..f18eb51 Binary files /dev/null and b/SegementAnimation/resources/desktop/common/close.png differ diff --git a/SegementAnimation/resources/desktop/common/defvideoposter.png b/SegementAnimation/resources/desktop/common/defvideoposter.png new file mode 100644 index 0000000..dc12be6 Binary files /dev/null and b/SegementAnimation/resources/desktop/common/defvideoposter.png differ diff --git a/SegementAnimation/resources/desktop/common/max.png b/SegementAnimation/resources/desktop/common/max.png new file mode 100644 index 0000000..1396ab7 Binary files /dev/null and b/SegementAnimation/resources/desktop/common/max.png differ diff --git a/SegementAnimation/resources/desktop/common/min.png b/SegementAnimation/resources/desktop/common/min.png new file mode 100644 index 0000000..60946ec Binary files /dev/null and b/SegementAnimation/resources/desktop/common/min.png differ diff --git a/SegementAnimation/resources/desktop/common/tableftarrow.png b/SegementAnimation/resources/desktop/common/tableftarrow.png new file mode 100644 index 0000000..e505aa4 Binary files /dev/null and b/SegementAnimation/resources/desktop/common/tableftarrow.png differ diff --git a/SegementAnimation/resources/desktop/common/tabrightarrow.png b/SegementAnimation/resources/desktop/common/tabrightarrow.png new file mode 100644 index 0000000..9701f3f Binary files /dev/null and b/SegementAnimation/resources/desktop/common/tabrightarrow.png differ diff --git a/SegementAnimation/resources/i18n/xml/i18n.txt b/SegementAnimation/resources/i18n/xml/i18n.txt new file mode 100644 index 0000000..e69de29 diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/back.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/back.png new file mode 100644 index 0000000..d567d64 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/back.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/delete.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/delete.png new file mode 100644 index 0000000..535dda9 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/delete.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/details_image.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/details_image.png new file mode 100644 index 0000000..e198101 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/details_image.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/fav_btn.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/fav_btn.png new file mode 100644 index 0000000..236242f Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/fav_btn.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/favorites.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/favorites.png new file mode 100644 index 0000000..ff4aa56 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/favorites.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img1.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img1.png new file mode 100644 index 0000000..ef0fd42 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img1.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img2.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img2.png new file mode 100644 index 0000000..dc4b067 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img2.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img3.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img3.png new file mode 100644 index 0000000..54efdf4 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/img3.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/logout.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/logout.png new file mode 100644 index 0000000..dbd45f7 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/logout.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map.png new file mode 100644 index 0000000..b33537f Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map_message_image.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map_message_image.png new file mode 100644 index 0000000..29f1dc6 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map_message_image.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map_pointer.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map_pointer.png new file mode 100644 index 0000000..dafaadf Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/map_pointer.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/more.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/more.png new file mode 100644 index 0000000..2c72019 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/more.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/off.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/off.png new file mode 100644 index 0000000..3d14ad7 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/off.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/on.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/on.png new file mode 100644 index 0000000..89b6aca Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/on.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/rate_btn.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/rate_btn.png new file mode 100644 index 0000000..a7aa43a Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/rate_btn.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-hdpi/splash.png b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/splash.png new file mode 100644 index 0000000..d3a6026 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-hdpi/splash.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/back.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/back.png new file mode 100644 index 0000000..8cb444b Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/back.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/delete.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/delete.png new file mode 100644 index 0000000..c62a2b1 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/delete.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/details_image.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/details_image.png new file mode 100644 index 0000000..28c9815 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/details_image.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/fav_btn.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/fav_btn.png new file mode 100644 index 0000000..1b32fae Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/fav_btn.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/favorites.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/favorites.png new file mode 100644 index 0000000..0649b4b Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/favorites.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img1.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img1.png new file mode 100644 index 0000000..aa71f4c Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img1.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img2.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img2.png new file mode 100644 index 0000000..7018084 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img2.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img3.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img3.png new file mode 100644 index 0000000..80bd281 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/img3.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/logout.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/logout.png new file mode 100644 index 0000000..c4244e9 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/logout.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map.png new file mode 100644 index 0000000..aac09d9 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map_message_image.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map_message_image.png new file mode 100644 index 0000000..96d93d9 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map_message_image.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map_pointer.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map_pointer.png new file mode 100644 index 0000000..4879e9c Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/map_pointer.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/more.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/more.png new file mode 100644 index 0000000..d78fe3a Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/more.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/off.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/off.png new file mode 100644 index 0000000..0838dcc Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/off.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/on.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/on.png new file mode 100644 index 0000000..afdd056 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/on.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/rate_btn.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/rate_btn.png new file mode 100644 index 0000000..95164c6 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/rate_btn.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-mdpi/splash.png b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/splash.png new file mode 100644 index 0000000..13d8e11 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-mdpi/splash.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/back.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/back.png new file mode 100644 index 0000000..66748a3 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/back.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/delete.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/delete.png new file mode 100644 index 0000000..b1c5348 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/delete.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/details_image.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/details_image.png new file mode 100644 index 0000000..bb56119 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/details_image.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/fav_btn.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/fav_btn.png new file mode 100644 index 0000000..4776928 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/fav_btn.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/favorites.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/favorites.png new file mode 100644 index 0000000..9634e42 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/favorites.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img1.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img1.png new file mode 100644 index 0000000..cf38441 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img1.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img2.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img2.png new file mode 100644 index 0000000..9c63529 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img2.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img3.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img3.png new file mode 100644 index 0000000..bb9ae86 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/img3.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/logout.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/logout.png new file mode 100644 index 0000000..1260353 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/logout.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map.png new file mode 100644 index 0000000..cb8a867 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map_message_image.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map_message_image.png new file mode 100644 index 0000000..875efd3 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map_message_image.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map_pointer.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map_pointer.png new file mode 100644 index 0000000..374a5ec Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/map_pointer.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/more.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/more.png new file mode 100644 index 0000000..c7f74d1 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/more.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/off.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/off.png new file mode 100644 index 0000000..3d14ad7 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/off.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/on.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/on.png new file mode 100644 index 0000000..89b6aca Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/on.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/rate_btn.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/rate_btn.png new file mode 100644 index 0000000..f9fbf52 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/rate_btn.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/splash.png b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/splash.png new file mode 100644 index 0000000..5b47388 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xhdpi/splash.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/back.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/back.png new file mode 100644 index 0000000..a2dd352 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/back.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/delete.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/delete.png new file mode 100644 index 0000000..5607410 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/delete.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/details_image.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/details_image.png new file mode 100644 index 0000000..46bb533 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/details_image.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/fav_btn.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/fav_btn.png new file mode 100644 index 0000000..5dad297 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/fav_btn.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/favorites.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/favorites.png new file mode 100644 index 0000000..51df795 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/favorites.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img1.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img1.png new file mode 100644 index 0000000..d1b46a4 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img1.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img2.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img2.png new file mode 100644 index 0000000..ac8f63f Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img2.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img3.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img3.png new file mode 100644 index 0000000..95e9d6c Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/img3.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/logout.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/logout.png new file mode 100644 index 0000000..0a057df Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/logout.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map.png new file mode 100644 index 0000000..7c7ab33 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map_message_image.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map_message_image.png new file mode 100644 index 0000000..3308896 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map_message_image.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map_pointer.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map_pointer.png new file mode 100644 index 0000000..5ddeea3 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/map_pointer.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/more.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/more.png new file mode 100644 index 0000000..8e977c3 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/more.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/off.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/off.png new file mode 100644 index 0000000..3d14ad7 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/off.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/on.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/on.png new file mode 100644 index 0000000..89b6aca Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/on.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/rate_btn.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/rate_btn.png new file mode 100644 index 0000000..f8d8d76 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/rate_btn.png differ diff --git a/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/splash.png b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/splash.png new file mode 100644 index 0000000..e704043 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/android/drawable-xxhdpi/splash.png differ diff --git a/SegementAnimation/resources/mobile/native/blackberry/down.png b/SegementAnimation/resources/mobile/native/blackberry/down.png new file mode 100644 index 0000000..29e23c5 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/blackberry/down.png differ diff --git a/SegementAnimation/resources/mobile/native/blackberry/f_down.png b/SegementAnimation/resources/mobile/native/blackberry/f_down.png new file mode 100644 index 0000000..29e23c5 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/blackberry/f_down.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/back@2x.png b/SegementAnimation/resources/mobile/native/iphone/back@2x.png new file mode 100644 index 0000000..5486e43 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/back@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/delete@2x.png b/SegementAnimation/resources/mobile/native/iphone/delete@2x.png new file mode 100644 index 0000000..6d1dc69 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/delete@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/details_image@2x.png b/SegementAnimation/resources/mobile/native/iphone/details_image@2x.png new file mode 100644 index 0000000..86b8624 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/details_image@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/fav_btn@2x.png b/SegementAnimation/resources/mobile/native/iphone/fav_btn@2x.png new file mode 100644 index 0000000..90abe29 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/fav_btn@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/favorites@2x.png b/SegementAnimation/resources/mobile/native/iphone/favorites@2x.png new file mode 100644 index 0000000..85d12fa Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/favorites@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/img1@2x.png b/SegementAnimation/resources/mobile/native/iphone/img1@2x.png new file mode 100644 index 0000000..b4e6583 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/img1@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/img2@2x.png b/SegementAnimation/resources/mobile/native/iphone/img2@2x.png new file mode 100644 index 0000000..6eaccd8 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/img2@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/img3@2x.png b/SegementAnimation/resources/mobile/native/iphone/img3@2x.png new file mode 100644 index 0000000..9b43545 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/img3@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/logout@2x.png b/SegementAnimation/resources/mobile/native/iphone/logout@2x.png new file mode 100644 index 0000000..a8b7554 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/logout@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/map@2x.png b/SegementAnimation/resources/mobile/native/iphone/map@2x.png new file mode 100644 index 0000000..e088e5b Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/map@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/map_message_image@2x.png b/SegementAnimation/resources/mobile/native/iphone/map_message_image@2x.png new file mode 100644 index 0000000..3d8732d Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/map_message_image@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/map_pointer@2x.png b/SegementAnimation/resources/mobile/native/iphone/map_pointer@2x.png new file mode 100644 index 0000000..3907bf8 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/map_pointer@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/more@2x.png b/SegementAnimation/resources/mobile/native/iphone/more@2x.png new file mode 100644 index 0000000..a3edbe2 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/more@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/off@2x.png b/SegementAnimation/resources/mobile/native/iphone/off@2x.png new file mode 100644 index 0000000..3c656ff Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/off@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/on@2x.png b/SegementAnimation/resources/mobile/native/iphone/on@2x.png new file mode 100644 index 0000000..1b4b16a Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/on@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/option1@2x.png b/SegementAnimation/resources/mobile/native/iphone/option1@2x.png new file mode 100644 index 0000000..4b0a73f Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/option1@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/option1@3x.png b/SegementAnimation/resources/mobile/native/iphone/option1@3x.png new file mode 100644 index 0000000..3970bd3 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/option1@3x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/option2@2x.png b/SegementAnimation/resources/mobile/native/iphone/option2@2x.png new file mode 100644 index 0000000..fc0e7e7 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/option2@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/option2@3x.png b/SegementAnimation/resources/mobile/native/iphone/option2@3x.png new file mode 100644 index 0000000..8d15e69 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/option2@3x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/option3@2x.png b/SegementAnimation/resources/mobile/native/iphone/option3@2x.png new file mode 100644 index 0000000..28f0a96 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/option3@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/option3@3x.png b/SegementAnimation/resources/mobile/native/iphone/option3@3x.png new file mode 100644 index 0000000..9a05e86 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/option3@3x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/option4@2x.png b/SegementAnimation/resources/mobile/native/iphone/option4@2x.png new file mode 100644 index 0000000..b1eda0f Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/option4@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/option4@3x.png b/SegementAnimation/resources/mobile/native/iphone/option4@3x.png new file mode 100644 index 0000000..a3d0779 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/option4@3x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/rate_btn@2x.png b/SegementAnimation/resources/mobile/native/iphone/rate_btn@2x.png new file mode 100644 index 0000000..87cf304 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/rate_btn@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/splash@2x.png b/SegementAnimation/resources/mobile/native/iphone/splash@2x.png new file mode 100644 index 0000000..0af14ed Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/splash@2x.png differ diff --git a/SegementAnimation/resources/mobile/native/iphone/splash@3x.png b/SegementAnimation/resources/mobile/native/iphone/splash@3x.png new file mode 100644 index 0000000..e704043 Binary files /dev/null and b/SegementAnimation/resources/mobile/native/iphone/splash@3x.png differ diff --git a/SegementAnimation/resources/mobile/web/spaandroid/defvideoposter.png b/SegementAnimation/resources/mobile/web/spaandroid/defvideoposter.png new file mode 100644 index 0000000..dc12be6 Binary files /dev/null and b/SegementAnimation/resources/mobile/web/spaandroid/defvideoposter.png differ diff --git a/SegementAnimation/resources/mobile/web/spablackberry/defvideoposter.png b/SegementAnimation/resources/mobile/web/spablackberry/defvideoposter.png new file mode 100644 index 0000000..dc12be6 Binary files /dev/null and b/SegementAnimation/resources/mobile/web/spablackberry/defvideoposter.png differ diff --git a/SegementAnimation/resources/mobile/web/spaiphone/defvideoposter.png b/SegementAnimation/resources/mobile/web/spaiphone/defvideoposter.png new file mode 100644 index 0000000..dc12be6 Binary files /dev/null and b/SegementAnimation/resources/mobile/web/spaiphone/defvideoposter.png differ diff --git a/SegementAnimation/resources/mobile/web/spawinphone8/defvideoposter.png b/SegementAnimation/resources/mobile/web/spawinphone8/defvideoposter.png new file mode 100644 index 0000000..dc12be6 Binary files /dev/null and b/SegementAnimation/resources/mobile/web/spawinphone8/defvideoposter.png differ diff --git a/SegementAnimation/resources/tablet/native/ipad/option1@2x.png b/SegementAnimation/resources/tablet/native/ipad/option1@2x.png new file mode 100644 index 0000000..4b0a73f Binary files /dev/null and b/SegementAnimation/resources/tablet/native/ipad/option1@2x.png differ diff --git a/SegementAnimation/resources/tablet/native/ipad/option1@3x.png b/SegementAnimation/resources/tablet/native/ipad/option1@3x.png new file mode 100644 index 0000000..3970bd3 Binary files /dev/null and b/SegementAnimation/resources/tablet/native/ipad/option1@3x.png differ diff --git a/SegementAnimation/resources/tablet/native/ipad/option2@2x.png b/SegementAnimation/resources/tablet/native/ipad/option2@2x.png new file mode 100644 index 0000000..fc0e7e7 Binary files /dev/null and b/SegementAnimation/resources/tablet/native/ipad/option2@2x.png differ diff --git a/SegementAnimation/resources/tablet/native/ipad/option2@3x.png b/SegementAnimation/resources/tablet/native/ipad/option2@3x.png new file mode 100644 index 0000000..8d15e69 Binary files /dev/null and b/SegementAnimation/resources/tablet/native/ipad/option2@3x.png differ diff --git a/SegementAnimation/resources/tablet/native/ipad/option3@2x.png b/SegementAnimation/resources/tablet/native/ipad/option3@2x.png new file mode 100644 index 0000000..28f0a96 Binary files /dev/null and b/SegementAnimation/resources/tablet/native/ipad/option3@2x.png differ diff --git a/SegementAnimation/resources/tablet/native/ipad/option3@3x.png b/SegementAnimation/resources/tablet/native/ipad/option3@3x.png new file mode 100644 index 0000000..9a05e86 Binary files /dev/null and b/SegementAnimation/resources/tablet/native/ipad/option3@3x.png differ diff --git a/SegementAnimation/resources/tablet/native/ipad/option4@2x.png b/SegementAnimation/resources/tablet/native/ipad/option4@2x.png new file mode 100644 index 0000000..b1eda0f Binary files /dev/null and b/SegementAnimation/resources/tablet/native/ipad/option4@2x.png differ diff --git a/SegementAnimation/resources/tablet/native/ipad/option4@3x.png b/SegementAnimation/resources/tablet/native/ipad/option4@3x.png new file mode 100644 index 0000000..a3d0779 Binary files /dev/null and b/SegementAnimation/resources/tablet/native/ipad/option4@3x.png differ diff --git a/SegementAnimation/resources/tablet/web/spaandroidtab/defvideoposter.png b/SegementAnimation/resources/tablet/web/spaandroidtab/defvideoposter.png new file mode 100644 index 0000000..dc12be6 Binary files /dev/null and b/SegementAnimation/resources/tablet/web/spaandroidtab/defvideoposter.png differ diff --git a/SegementAnimation/resources/tablet/web/spaipad/defvideoposter.png b/SegementAnimation/resources/tablet/web/spaipad/defvideoposter.png new file mode 100644 index 0000000..dc12be6 Binary files /dev/null and b/SegementAnimation/resources/tablet/web/spaipad/defvideoposter.png differ diff --git a/SegementAnimation/resources/tablet/web/spawindowstablet/defvideoposter.png b/SegementAnimation/resources/tablet/web/spawindowstablet/defvideoposter.png new file mode 100644 index 0000000..dc12be6 Binary files /dev/null and b/SegementAnimation/resources/tablet/web/spawindowstablet/defvideoposter.png differ diff --git a/SegementAnimation/run.bat b/SegementAnimation/run.bat new file mode 100644 index 0000000..bf0c77c --- /dev/null +++ b/SegementAnimation/run.bat @@ -0,0 +1,6 @@ +echo input.file %1 +echo workspace.loc %2 +echo equinox.jar %3 +echo global.file %4 +java -Dfile.encoding=UTF-8 -Dinput.file=%1 -Dglobal.file=%4 -cp %3 org.eclipse.core.launcher.Main -data %2 -application com.pat.tool.keditor.konyapplication +exit %ERRORLEVEL% \ No newline at end of file diff --git a/SegementAnimation/run.sh b/SegementAnimation/run.sh new file mode 100644 index 0000000..e191487 --- /dev/null +++ b/SegementAnimation/run.sh @@ -0,0 +1,3 @@ +#!/bin/sh +java -XstartOnFirstThread -Dfile.encoding=UTF-8 -Dinput.file=$1 -Dglobal.file=$4 -cp $3 org.eclipse.core.launcher.Main -data $2 -application com.pat.tool.keditor.konyapplication +exit $? \ No newline at end of file diff --git a/SegementAnimation/services/appconfig.xml b/SegementAnimation/services/appconfig.xml new file mode 100644 index 0000000..53c6d9a --- /dev/null +++ b/SegementAnimation/services/appconfig.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/SegementAnimation/splashscreenproperties.json b/SegementAnimation/splashscreenproperties.json new file mode 100644 index 0000000..4682824 --- /dev/null +++ b/SegementAnimation/splashscreenproperties.json @@ -0,0 +1,38 @@ +{ + "splashScreen": { + "mobile": { + "iphone": { + "splashImage": "splash.png", + "showLoadingIndicator": true + }, + "android": { + "showLoadingIndicator": false, + "backgroundColor": "323d48" + }, + "winphone8": { + "showLoadingIndicator": false + }, + "spa": {}, + "spaip": {}, + "spaan": {}, + "spawinphone8": {}, + "showLoadingIndicator": false, + "splashImage": "splash.png" + }, + "tablet": { + "ipad": { + "landscape": {} + }, + "android": {}, + "windows8": {}, + "spa": {}, + "spaipad": {}, + "spaandroidtablet": {}, + "spawindowstablet": {} + }, + "desktop": { + "desktopweb": {}, + "kiosk": {} + } + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_AppEvents_8a84016745d44ecba1d25abf940da40d.js b/SegementAnimation/studioactions/mobile/AS_AppEvents_8a84016745d44ecba1d25abf940da40d.js new file mode 100644 index 0000000..5bb75bc --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_AppEvents_8a84016745d44ecba1d25abf940da40d.js @@ -0,0 +1,3 @@ +function AS_AppEvents_8a84016745d44ecba1d25abf940da40d() { + return setGestureRecogniserToFrmfav.call(this); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_AppEvents_8a84016745d44ecba1d25abf940da40d.json b/SegementAnimation/studioactions/mobile/AS_AppEvents_8a84016745d44ecba1d25abf940da40d.json new file mode 100644 index 0000000..337eb45 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_AppEvents_8a84016745d44ecba1d25abf940da40d.json @@ -0,0 +1,15 @@ +{ + "AS_AppEvents_8a84016745d44ecba1d25abf940da40d": { + "id": "AS_AppEvents_8a84016745d44ecba1d25abf940da40d", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___7f7d1d2489aa4a128f8bc626fa3e5b05", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "setGestureRecogniserToFrmfav", + "display": "setGestureRecogniserToFrmfav", + "inputparams": [], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_017ee2fd4cf24cb691ed81b98a450c4d.js b/SegementAnimation/studioactions/mobile/AS_Button_017ee2fd4cf24cb691ed81b98a450c4d.js new file mode 100644 index 0000000..57e21eb --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_017ee2fd4cf24cb691ed81b98a450c4d.js @@ -0,0 +1 @@ +function AS_Button_017ee2fd4cf24cb691ed81b98a450c4d() {} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_017ee2fd4cf24cb691ed81b98a450c4d.json b/SegementAnimation/studioactions/mobile/AS_Button_017ee2fd4cf24cb691ed81b98a450c4d.json new file mode 100644 index 0000000..c736eb2 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_017ee2fd4cf24cb691ed81b98a450c4d.json @@ -0,0 +1,7 @@ +{ + "AS_Button_017ee2fd4cf24cb691ed81b98a450c4d": { + "id": "AS_Button_017ee2fd4cf24cb691ed81b98a450c4d", + "type": "ACTION_SEQUENCE", + "actions": [] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_0848ac8a1d754db4a442d009b0b64eec.js b/SegementAnimation/studioactions/mobile/AS_Button_0848ac8a1d754db4a442d009b0b64eec.js new file mode 100644 index 0000000..a38cf53 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_0848ac8a1d754db4a442d009b0b64eec.js @@ -0,0 +1 @@ +function AS_Button_0848ac8a1d754db4a442d009b0b64eec() {} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_0848ac8a1d754db4a442d009b0b64eec.json b/SegementAnimation/studioactions/mobile/AS_Button_0848ac8a1d754db4a442d009b0b64eec.json new file mode 100644 index 0000000..0421905 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_0848ac8a1d754db4a442d009b0b64eec.json @@ -0,0 +1,7 @@ +{ + "AS_Button_0848ac8a1d754db4a442d009b0b64eec": { + "id": "AS_Button_0848ac8a1d754db4a442d009b0b64eec", + "type": "ACTION_SEQUENCE", + "actions": [] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_0db48114e4724fdfa4ee4aa816e9b983.js b/SegementAnimation/studioactions/mobile/AS_Button_0db48114e4724fdfa4ee4aa816e9b983.js new file mode 100644 index 0000000..1211278 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_0db48114e4724fdfa4ee4aa816e9b983.js @@ -0,0 +1,3 @@ +function AS_Button_0db48114e4724fdfa4ee4aa816e9b983() { + frmHome.show(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_0db48114e4724fdfa4ee4aa816e9b983.json b/SegementAnimation/studioactions/mobile/AS_Button_0db48114e4724fdfa4ee4aa816e9b983.json new file mode 100644 index 0000000..cd80b61 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_0db48114e4724fdfa4ee4aa816e9b983.json @@ -0,0 +1,17 @@ +{ + "AS_Button_0db48114e4724fdfa4ee4aa816e9b983": { + "id": "AS_Button_0db48114e4724fdfa4ee4aa816e9b983", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "NAVIGATE_TO_FORM___5e2370bc3ea944a0aee4f4b741281457", + "type": "NAVIGATE_TO_FORM", + "formId": "frmHome", + "formKUID": "37680ca2c04e4806a51d8d2b12f736eb", + "mappings": {}, + "mappingsOrder": [], + "parentId": "", + "callbackType": null, + "enableMappingEditor": true + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_1d68940a89594958a42bacc12f78bb08.js b/SegementAnimation/studioactions/mobile/AS_Button_1d68940a89594958a42bacc12f78bb08.js new file mode 100644 index 0000000..5f11cfc --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_1d68940a89594958a42bacc12f78bb08.js @@ -0,0 +1,3 @@ +function AS_Button_1d68940a89594958a42bacc12f78bb08() { + return removeRestaurents.call(this); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_1d68940a89594958a42bacc12f78bb08.json b/SegementAnimation/studioactions/mobile/AS_Button_1d68940a89594958a42bacc12f78bb08.json new file mode 100644 index 0000000..33b9424 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_1d68940a89594958a42bacc12f78bb08.json @@ -0,0 +1,15 @@ +{ + "AS_Button_1d68940a89594958a42bacc12f78bb08": { + "id": "AS_Button_1d68940a89594958a42bacc12f78bb08", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___2830ab0dad6a4b1db4b40ff55105e4e9", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "removeRestaurents", + "display": "removeRestaurents", + "inputparams": [], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_22e8acb8adc447c6af2cf12b3878f275.js b/SegementAnimation/studioactions/mobile/AS_Button_22e8acb8adc447c6af2cf12b3878f275.js new file mode 100644 index 0000000..a047805 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_22e8acb8adc447c6af2cf12b3878f275.js @@ -0,0 +1,3 @@ +function AS_Button_22e8acb8adc447c6af2cf12b3878f275(eventobject) { + frmtest.show(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_22e8acb8adc447c6af2cf12b3878f275.json b/SegementAnimation/studioactions/mobile/AS_Button_22e8acb8adc447c6af2cf12b3878f275.json new file mode 100644 index 0000000..58861a7 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_22e8acb8adc447c6af2cf12b3878f275.json @@ -0,0 +1,27 @@ +{ + "AS_Button_22e8acb8adc447c6af2cf12b3878f275": { + "id": "AS_Button_22e8acb8adc447c6af2cf12b3878f275", + "type": "ACTION_SEQUENCE", + "params": [{ + "datatype": "collection", + "name": "eventobject" + }], + "contextObj": { + "name": "Form00a240e66adfc4e", + "type": "forms", + "platform": null, + "KUID": "cd0622d57cea4aa5a0e9fd618fc4dda5" + }, + "actions": [{ + "id": "NAVIGATE_TO_FORM___51e67420bbe345c18ad439c9e77e0223", + "type": "NAVIGATE_TO_FORM", + "formId": "frmtest", + "formKUID": "e2c7f25ece8843aeabbfef0f32530566", + "mappings": {}, + "mappingsOrder": [], + "parentId": "", + "callbackType": null, + "enableMappingEditor": true + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_379bbc50b54b4a8b85f2e807a34bf986.js b/SegementAnimation/studioactions/mobile/AS_Button_379bbc50b54b4a8b85f2e807a34bf986.js new file mode 100644 index 0000000..f3ab54d --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_379bbc50b54b4a8b85f2e807a34bf986.js @@ -0,0 +1 @@ +function AS_Button_379bbc50b54b4a8b85f2e807a34bf986() {} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_379bbc50b54b4a8b85f2e807a34bf986.json b/SegementAnimation/studioactions/mobile/AS_Button_379bbc50b54b4a8b85f2e807a34bf986.json new file mode 100644 index 0000000..a45032d --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_379bbc50b54b4a8b85f2e807a34bf986.json @@ -0,0 +1,7 @@ +{ + "AS_Button_379bbc50b54b4a8b85f2e807a34bf986": { + "id": "AS_Button_379bbc50b54b4a8b85f2e807a34bf986", + "type": "ACTION_SEQUENCE", + "actions": [] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_42732995e28e46cbb29e15fb18fd394c.js b/SegementAnimation/studioactions/mobile/AS_Button_42732995e28e46cbb29e15fb18fd394c.js new file mode 100644 index 0000000..fe8a582 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_42732995e28e46cbb29e15fb18fd394c.js @@ -0,0 +1,3 @@ +function AS_Button_42732995e28e46cbb29e15fb18fd394c() { + return testbuttononclick.call(this, widget, context); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_42732995e28e46cbb29e15fb18fd394c.json b/SegementAnimation/studioactions/mobile/AS_Button_42732995e28e46cbb29e15fb18fd394c.json new file mode 100644 index 0000000..64dac3e --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_42732995e28e46cbb29e15fb18fd394c.json @@ -0,0 +1,21 @@ +{ + "AS_Button_42732995e28e46cbb29e15fb18fd394c": { + "id": "AS_Button_42732995e28e46cbb29e15fb18fd394c", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___20d863c8e109497d91eaec7a222b6445", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "testbuttononclick", + "display": "testbuttononclick", + "inputparams": [{ + "name": "widget", + "value": "widget" + }, { + "name": "context", + "value": "context" + }], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_604431158ee04a4aa2b804008a9e706b.js b/SegementAnimation/studioactions/mobile/AS_Button_604431158ee04a4aa2b804008a9e706b.js new file mode 100644 index 0000000..184fe77 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_604431158ee04a4aa2b804008a9e706b.js @@ -0,0 +1,3 @@ +function AS_Button_604431158ee04a4aa2b804008a9e706b() { + frmHome.show(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_604431158ee04a4aa2b804008a9e706b.json b/SegementAnimation/studioactions/mobile/AS_Button_604431158ee04a4aa2b804008a9e706b.json new file mode 100644 index 0000000..b0d68c4 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_604431158ee04a4aa2b804008a9e706b.json @@ -0,0 +1,17 @@ +{ + "AS_Button_604431158ee04a4aa2b804008a9e706b": { + "id": "AS_Button_604431158ee04a4aa2b804008a9e706b", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "NAVIGATE_TO_FORM___6b9d8ce74c354888801e90f3ef111f8e", + "type": "NAVIGATE_TO_FORM", + "formId": "frmHome", + "formKUID": "37680ca2c04e4806a51d8d2b12f736eb", + "mappings": {}, + "mappingsOrder": [], + "parentId": "", + "callbackType": null, + "enableMappingEditor": true + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_7b8cc19147914893a980985460699502.js b/SegementAnimation/studioactions/mobile/AS_Button_7b8cc19147914893a980985460699502.js new file mode 100644 index 0000000..3fe799d --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_7b8cc19147914893a980985460699502.js @@ -0,0 +1,3 @@ +function AS_Button_7b8cc19147914893a980985460699502() { + return markAsFavouriteRestaurent.call(this); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_7b8cc19147914893a980985460699502.json b/SegementAnimation/studioactions/mobile/AS_Button_7b8cc19147914893a980985460699502.json new file mode 100644 index 0000000..272fbef --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_7b8cc19147914893a980985460699502.json @@ -0,0 +1,15 @@ +{ + "AS_Button_7b8cc19147914893a980985460699502": { + "id": "AS_Button_7b8cc19147914893a980985460699502", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___b877ad53975c4b2e9713df7160654f17", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "markAsFavouriteRestaurent", + "display": "markAsFavouriteRestaurent", + "inputparams": [], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_80b8d034a55549c5ae72f76855cbf8ff.js b/SegementAnimation/studioactions/mobile/AS_Button_80b8d034a55549c5ae72f76855cbf8ff.js new file mode 100644 index 0000000..91c2fbe --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_80b8d034a55549c5ae72f76855cbf8ff.js @@ -0,0 +1,3 @@ +function AS_Button_80b8d034a55549c5ae72f76855cbf8ff() { + frmLogin.show(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_80b8d034a55549c5ae72f76855cbf8ff.json b/SegementAnimation/studioactions/mobile/AS_Button_80b8d034a55549c5ae72f76855cbf8ff.json new file mode 100644 index 0000000..f9bb941 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_80b8d034a55549c5ae72f76855cbf8ff.json @@ -0,0 +1,17 @@ +{ + "AS_Button_80b8d034a55549c5ae72f76855cbf8ff": { + "id": "AS_Button_80b8d034a55549c5ae72f76855cbf8ff", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "NAVIGATE_TO_FORM___0ba20c838b9148c58b2b7dd3bd24ab86", + "type": "NAVIGATE_TO_FORM", + "formId": "frmLogin", + "formKUID": "412c778f25424689962af76fbfac1efc", + "mappings": {}, + "mappingsOrder": [], + "parentId": "", + "callbackType": null, + "enableMappingEditor": true + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_8a58f339461b44788740028b23efa6a1.js b/SegementAnimation/studioactions/mobile/AS_Button_8a58f339461b44788740028b23efa6a1.js new file mode 100644 index 0000000..4553d72 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_8a58f339461b44788740028b23efa6a1.js @@ -0,0 +1 @@ +function AS_Button_8a58f339461b44788740028b23efa6a1() {} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_8a58f339461b44788740028b23efa6a1.json b/SegementAnimation/studioactions/mobile/AS_Button_8a58f339461b44788740028b23efa6a1.json new file mode 100644 index 0000000..b89c7bb --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_8a58f339461b44788740028b23efa6a1.json @@ -0,0 +1,7 @@ +{ + "AS_Button_8a58f339461b44788740028b23efa6a1": { + "id": "AS_Button_8a58f339461b44788740028b23efa6a1", + "type": "ACTION_SEQUENCE", + "actions": [] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_b255b3f1793d49658a396e8698e1322d.js b/SegementAnimation/studioactions/mobile/AS_Button_b255b3f1793d49658a396e8698e1322d.js new file mode 100644 index 0000000..9e42397 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_b255b3f1793d49658a396e8698e1322d.js @@ -0,0 +1 @@ +function AS_Button_b255b3f1793d49658a396e8698e1322d() {} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_b255b3f1793d49658a396e8698e1322d.json b/SegementAnimation/studioactions/mobile/AS_Button_b255b3f1793d49658a396e8698e1322d.json new file mode 100644 index 0000000..1862a98 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_b255b3f1793d49658a396e8698e1322d.json @@ -0,0 +1,7 @@ +{ + "AS_Button_b255b3f1793d49658a396e8698e1322d": { + "id": "AS_Button_b255b3f1793d49658a396e8698e1322d", + "type": "ACTION_SEQUENCE", + "actions": [] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_b6b561388e5942b285974b7aaf09ab9f.js b/SegementAnimation/studioactions/mobile/AS_Button_b6b561388e5942b285974b7aaf09ab9f.js new file mode 100644 index 0000000..4bca0ad --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_b6b561388e5942b285974b7aaf09ab9f.js @@ -0,0 +1,3 @@ +function AS_Button_b6b561388e5942b285974b7aaf09ab9f() { + frmFavorite.show(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_b6b561388e5942b285974b7aaf09ab9f.json b/SegementAnimation/studioactions/mobile/AS_Button_b6b561388e5942b285974b7aaf09ab9f.json new file mode 100644 index 0000000..5d51729 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_b6b561388e5942b285974b7aaf09ab9f.json @@ -0,0 +1,17 @@ +{ + "AS_Button_b6b561388e5942b285974b7aaf09ab9f": { + "id": "AS_Button_b6b561388e5942b285974b7aaf09ab9f", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "NAVIGATE_TO_FORM___040660bd34e442c6b5f1d9a985d359b7", + "type": "NAVIGATE_TO_FORM", + "formId": "frmFavorite", + "formKUID": "b2a3f67b9cc04c0789d3251c370928c9", + "mappings": {}, + "mappingsOrder": [], + "parentId": "", + "callbackType": null, + "enableMappingEditor": true + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_ba8009aaff6d48da9c9a68d09def217f.js b/SegementAnimation/studioactions/mobile/AS_Button_ba8009aaff6d48da9c9a68d09def217f.js new file mode 100644 index 0000000..fe460bc --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_ba8009aaff6d48da9c9a68d09def217f.js @@ -0,0 +1,3 @@ +function AS_Button_ba8009aaff6d48da9c9a68d09def217f() { + frmHome.show(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_ba8009aaff6d48da9c9a68d09def217f.json b/SegementAnimation/studioactions/mobile/AS_Button_ba8009aaff6d48da9c9a68d09def217f.json new file mode 100644 index 0000000..f83d37c --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_ba8009aaff6d48da9c9a68d09def217f.json @@ -0,0 +1,17 @@ +{ + "AS_Button_ba8009aaff6d48da9c9a68d09def217f": { + "id": "AS_Button_ba8009aaff6d48da9c9a68d09def217f", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "NAVIGATE_TO_FORM___8fe9090e45694acbb9e0e36ef8c43793", + "type": "NAVIGATE_TO_FORM", + "formId": "frmHome", + "formKUID": "37680ca2c04e4806a51d8d2b12f736eb", + "mappings": {}, + "mappingsOrder": [], + "parentId": "", + "callbackType": null, + "enableMappingEditor": true + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_ccf20d6307034e66891dbd30f65a3d7e.js b/SegementAnimation/studioactions/mobile/AS_Button_ccf20d6307034e66891dbd30f65a3d7e.js new file mode 100644 index 0000000..2d7206b --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_ccf20d6307034e66891dbd30f65a3d7e.js @@ -0,0 +1,3 @@ +function AS_Button_ccf20d6307034e66891dbd30f65a3d7e() { + frmLogin.show(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_ccf20d6307034e66891dbd30f65a3d7e.json b/SegementAnimation/studioactions/mobile/AS_Button_ccf20d6307034e66891dbd30f65a3d7e.json new file mode 100644 index 0000000..6852e99 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_ccf20d6307034e66891dbd30f65a3d7e.json @@ -0,0 +1,17 @@ +{ + "AS_Button_ccf20d6307034e66891dbd30f65a3d7e": { + "id": "AS_Button_ccf20d6307034e66891dbd30f65a3d7e", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "NAVIGATE_TO_FORM___163a9ff53ee64b41b1090f1f6de2c9e3", + "type": "NAVIGATE_TO_FORM", + "formId": "frmLogin", + "formKUID": "412c778f25424689962af76fbfac1efc", + "mappings": {}, + "mappingsOrder": [], + "parentId": "", + "callbackType": null, + "enableMappingEditor": true + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_dbf5be30e7b5481ca6c50234170f4002.js b/SegementAnimation/studioactions/mobile/AS_Button_dbf5be30e7b5481ca6c50234170f4002.js new file mode 100644 index 0000000..b88c0da --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_dbf5be30e7b5481ca6c50234170f4002.js @@ -0,0 +1,3 @@ +function AS_Button_dbf5be30e7b5481ca6c50234170f4002() { + return setRestaurents.call(this); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_dbf5be30e7b5481ca6c50234170f4002.json b/SegementAnimation/studioactions/mobile/AS_Button_dbf5be30e7b5481ca6c50234170f4002.json new file mode 100644 index 0000000..5186462 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_dbf5be30e7b5481ca6c50234170f4002.json @@ -0,0 +1,15 @@ +{ + "AS_Button_dbf5be30e7b5481ca6c50234170f4002": { + "id": "AS_Button_dbf5be30e7b5481ca6c50234170f4002", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___62d4629d1fa146a2a7dffa7255e81155", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "setRestaurents", + "display": "setRestaurents", + "inputparams": [], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_ddc4d74f8fdb473d8d278d35b9e59929.js b/SegementAnimation/studioactions/mobile/AS_Button_ddc4d74f8fdb473d8d278d35b9e59929.js new file mode 100644 index 0000000..59d54f0 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_ddc4d74f8fdb473d8d278d35b9e59929.js @@ -0,0 +1 @@ +function AS_Button_ddc4d74f8fdb473d8d278d35b9e59929() {} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_ddc4d74f8fdb473d8d278d35b9e59929.json b/SegementAnimation/studioactions/mobile/AS_Button_ddc4d74f8fdb473d8d278d35b9e59929.json new file mode 100644 index 0000000..ca54084 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_ddc4d74f8fdb473d8d278d35b9e59929.json @@ -0,0 +1,7 @@ +{ + "AS_Button_ddc4d74f8fdb473d8d278d35b9e59929": { + "id": "AS_Button_ddc4d74f8fdb473d8d278d35b9e59929", + "type": "ACTION_SEQUENCE", + "actions": [] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41.js b/SegementAnimation/studioactions/mobile/AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41.js new file mode 100644 index 0000000..db7db34 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41.js @@ -0,0 +1 @@ +function AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41() {} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41.json b/SegementAnimation/studioactions/mobile/AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41.json new file mode 100644 index 0000000..af328d8 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41.json @@ -0,0 +1,7 @@ +{ + "AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41": { + "id": "AS_Button_e72209a6be7d4233a2f85ec7a4ad4d41", + "type": "ACTION_SEQUENCE", + "actions": [] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_eca2998968164527addd369d01ff55af.js b/SegementAnimation/studioactions/mobile/AS_Button_eca2998968164527addd369d01ff55af.js new file mode 100644 index 0000000..fffdc34 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_eca2998968164527addd369d01ff55af.js @@ -0,0 +1,3 @@ +function AS_Button_eca2998968164527addd369d01ff55af() { + frmHome.show(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Button_eca2998968164527addd369d01ff55af.json b/SegementAnimation/studioactions/mobile/AS_Button_eca2998968164527addd369d01ff55af.json new file mode 100644 index 0000000..735acac --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Button_eca2998968164527addd369d01ff55af.json @@ -0,0 +1,17 @@ +{ + "AS_Button_eca2998968164527addd369d01ff55af": { + "id": "AS_Button_eca2998968164527addd369d01ff55af", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "NAVIGATE_TO_FORM__ide_onClick_b3fa7addd0274759a22d9fa6ec5cc41a", + "type": "NAVIGATE_TO_FORM", + "formId": "frmHome", + "formKUID": "37680ca2c04e4806a51d8d2b12f736eb", + "mappings": {}, + "mappingsOrder": [], + "parentId": "", + "callbackType": null, + "enableMappingEditor": true + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61.js b/SegementAnimation/studioactions/mobile/AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61.js new file mode 100644 index 0000000..55ccb14 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61.js @@ -0,0 +1,3 @@ +function AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61() { + deleteSegRow(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61.json b/SegementAnimation/studioactions/mobile/AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61.json new file mode 100644 index 0000000..0f0955a --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61.json @@ -0,0 +1,13 @@ +{ + "AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61": { + "id": "AS_FlexContainer_8d59f70955864c1abe0b096c3e086e61", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "ADD_SNIPPET__aa08f75fd1a24d7d86437ea1f63d26fd", + "type": "ADD_SNIPPET", + "codeSnippet": "deleteSegRow();", + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf.js b/SegementAnimation/studioactions/mobile/AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf.js new file mode 100644 index 0000000..829d0cf --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf.js @@ -0,0 +1,3 @@ +function AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf() { + return deleteSegRow.call(this, this, context); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf.json b/SegementAnimation/studioactions/mobile/AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf.json new file mode 100644 index 0000000..fec21d8 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf.json @@ -0,0 +1,21 @@ +{ + "AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf": { + "id": "AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___cf728f05792d4c82ac7cf2bdb3ca9f79", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "deleteSegRow", + "display": "deleteSegRow", + "inputparams": [{ + "name": "abc", + "value": "this" + }, { + "name": "xyz", + "value": "context" + }], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_24f504db645f4df0a3e742c828e241b5.js b/SegementAnimation/studioactions/mobile/AS_Form_24f504db645f4df0a3e742c828e241b5.js new file mode 100644 index 0000000..ae6d3b1 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_24f504db645f4df0a3e742c828e241b5.js @@ -0,0 +1,3 @@ +function AS_Form_24f504db645f4df0a3e742c828e241b5() { + return animateLoginWidget1.call(this); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_24f504db645f4df0a3e742c828e241b5.json b/SegementAnimation/studioactions/mobile/AS_Form_24f504db645f4df0a3e742c828e241b5.json new file mode 100644 index 0000000..273f134 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_24f504db645f4df0a3e742c828e241b5.json @@ -0,0 +1,15 @@ +{ + "AS_Form_24f504db645f4df0a3e742c828e241b5": { + "id": "AS_Form_24f504db645f4df0a3e742c828e241b5", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___eff0540db8ec4a0f8dc0a3ad9e3255ae", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "animateLoginWidget1", + "display": "animateLoginWidget1", + "inputparams": [], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_7e44589989664a03ba9d3fb4f40ae78d.js b/SegementAnimation/studioactions/mobile/AS_Form_7e44589989664a03ba9d3fb4f40ae78d.js new file mode 100644 index 0000000..23f9bad --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_7e44589989664a03ba9d3fb4f40ae78d.js @@ -0,0 +1,4 @@ +function AS_Form_7e44589989664a03ba9d3fb4f40ae78d() { + setFavoriteRestaurent1.call(this); + setDeleteButtonCallBack(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_7e44589989664a03ba9d3fb4f40ae78d.json b/SegementAnimation/studioactions/mobile/AS_Form_7e44589989664a03ba9d3fb4f40ae78d.json new file mode 100644 index 0000000..fa220eb --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_7e44589989664a03ba9d3fb4f40ae78d.json @@ -0,0 +1,21 @@ +{ + "AS_Form_7e44589989664a03ba9d3fb4f40ae78d": { + "id": "AS_Form_7e44589989664a03ba9d3fb4f40ae78d", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___721e62c2ff2649328f5433c1f0ba7d40", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "setFavoriteRestaurent1", + "display": "setFavoriteRestaurent1", + "inputparams": [], + "parentId": null, + "callbackType": null + }, { + "id": "ADD_SNIPPET__4621c0faff534d7c8cb41e8551e6e89e", + "type": "ADD_SNIPPET", + "codeSnippet": "setDeleteButtonCallBack();", + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_9668d973e74e4b14b3ed226faa287aa5.js b/SegementAnimation/studioactions/mobile/AS_Form_9668d973e74e4b14b3ed226faa287aa5.js new file mode 100644 index 0000000..d33152d --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_9668d973e74e4b14b3ed226faa287aa5.js @@ -0,0 +1,4 @@ +function AS_Form_9668d973e74e4b14b3ed226faa287aa5() { + //setGestureRecogniserToFrmHome(); + removeRestaurents(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_9668d973e74e4b14b3ed226faa287aa5.json b/SegementAnimation/studioactions/mobile/AS_Form_9668d973e74e4b14b3ed226faa287aa5.json new file mode 100644 index 0000000..2aa94fc --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_9668d973e74e4b14b3ed226faa287aa5.json @@ -0,0 +1,13 @@ +{ + "AS_Form_9668d973e74e4b14b3ed226faa287aa5": { + "id": "AS_Form_9668d973e74e4b14b3ed226faa287aa5", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "ADD_SNIPPET__29441ff5362a4893a82f55ffdf556e15", + "type": "ADD_SNIPPET", + "codeSnippet": "//setGestureRecogniserToFrmHome();\nremoveRestaurents();", + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_cc6d3719edab4037807254f5a17c49d2.js b/SegementAnimation/studioactions/mobile/AS_Form_cc6d3719edab4037807254f5a17c49d2.js new file mode 100644 index 0000000..9d24cd3 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_cc6d3719edab4037807254f5a17c49d2.js @@ -0,0 +1,10 @@ +function AS_Form_cc6d3719edab4037807254f5a17c49d2() { + kony.application.setApplicationBehaviors({ + applyMarginPaddingInBCGMode: false, + adherePercentageStrictly: true, + retainSpaceOnHide: true, + marginsIncludedInWidgetContainerWeight: true, + APILevel: 6800, + hideDefaultLoadingIndicator: true, + }) +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_cc6d3719edab4037807254f5a17c49d2.json b/SegementAnimation/studioactions/mobile/AS_Form_cc6d3719edab4037807254f5a17c49d2.json new file mode 100644 index 0000000..e8745d7 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_cc6d3719edab4037807254f5a17c49d2.json @@ -0,0 +1,19 @@ +{ + "AS_Form_cc6d3719edab4037807254f5a17c49d2": { + "id": "AS_Form_cc6d3719edab4037807254f5a17c49d2", + "type": "ACTION_SEQUENCE", + "contextObj": { + "name": "frmLogin", + "type": "forms", + "platform": "", + "KUID": "412c778f25424689962af76fbfac1efc" + }, + "actions": [{ + "id": "ADD_SNIPPET__7aaee2277f1a4395addb5b5df0e5245e", + "type": "ADD_SNIPPET", + "codeSnippet": "kony.application.setApplicationBehaviors({\n applyMarginPaddingInBCGMode: false,\n adherePercentageStrictly: true,\n retainSpaceOnHide: true,\n marginsIncludedInWidgetContainerWeight: true,\n APILevel: 6800,\n hideDefaultLoadingIndicator:true,\n })", + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4.js b/SegementAnimation/studioactions/mobile/AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4.js new file mode 100644 index 0000000..326bce1 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4.js @@ -0,0 +1,4 @@ +function AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4() { + setRestaurents(); + onRowDisplayFunction(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4.json b/SegementAnimation/studioactions/mobile/AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4.json new file mode 100644 index 0000000..5817dd0 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4.json @@ -0,0 +1,13 @@ +{ + "AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4": { + "id": "AS_Form_d5e1ebbbfcca4bb5a2d80b58975865d4", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "ADD_SNIPPET__6db8a081d0fe4ac9b2af26a482fe98c8", + "type": "ADD_SNIPPET", + "codeSnippet": "setRestaurents();\nonRowDisplayFunction();", + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Image_03289ea1a97941f2b212711370ecdef7.js b/SegementAnimation/studioactions/mobile/AS_Image_03289ea1a97941f2b212711370ecdef7.js new file mode 100644 index 0000000..21c9078 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Image_03289ea1a97941f2b212711370ecdef7.js @@ -0,0 +1 @@ +function AS_Image_03289ea1a97941f2b212711370ecdef7() {} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Image_03289ea1a97941f2b212711370ecdef7.json b/SegementAnimation/studioactions/mobile/AS_Image_03289ea1a97941f2b212711370ecdef7.json new file mode 100644 index 0000000..3075d24 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Image_03289ea1a97941f2b212711370ecdef7.json @@ -0,0 +1,7 @@ +{ + "AS_Image_03289ea1a97941f2b212711370ecdef7": { + "id": "AS_Image_03289ea1a97941f2b212711370ecdef7", + "type": "ACTION_SEQUENCE", + "actions": [] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Segment_df46bfdce97f4382bcd85438f80ebb5b.js b/SegementAnimation/studioactions/mobile/AS_Segment_df46bfdce97f4382bcd85438f80ebb5b.js new file mode 100644 index 0000000..abfd0dc --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Segment_df46bfdce97f4382bcd85438f80ebb5b.js @@ -0,0 +1,3 @@ +function AS_Segment_df46bfdce97f4382bcd85438f80ebb5b() { + showRestaurentDetails1(); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_Segment_df46bfdce97f4382bcd85438f80ebb5b.json b/SegementAnimation/studioactions/mobile/AS_Segment_df46bfdce97f4382bcd85438f80ebb5b.json new file mode 100644 index 0000000..22a0138 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_Segment_df46bfdce97f4382bcd85438f80ebb5b.json @@ -0,0 +1,13 @@ +{ + "AS_Segment_df46bfdce97f4382bcd85438f80ebb5b": { + "id": "AS_Segment_df46bfdce97f4382bcd85438f80ebb5b", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "ADD_SNIPPET__999ec18f8ad249c09284bcee7f857a2f", + "type": "ADD_SNIPPET", + "codeSnippet": "showRestaurentDetails1();", + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_TitleBar_030774e7928a4470868971424d994218.js b/SegementAnimation/studioactions/mobile/AS_TitleBar_030774e7928a4470868971424d994218.js new file mode 100644 index 0000000..8565692 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_TitleBar_030774e7928a4470868971424d994218.js @@ -0,0 +1,3 @@ +function AS_TitleBar_030774e7928a4470868971424d994218() { + return setRestaurents.call(this); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_TitleBar_030774e7928a4470868971424d994218.json b/SegementAnimation/studioactions/mobile/AS_TitleBar_030774e7928a4470868971424d994218.json new file mode 100644 index 0000000..c23c343 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_TitleBar_030774e7928a4470868971424d994218.json @@ -0,0 +1,15 @@ +{ + "AS_TitleBar_030774e7928a4470868971424d994218": { + "id": "AS_TitleBar_030774e7928a4470868971424d994218", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___76ec8cff57e8467e9e1bcdf89fe50a49", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "setRestaurents", + "display": "setRestaurents", + "inputparams": [], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_TitleBar_f32cc18519a749a59bb578c932852e95.js b/SegementAnimation/studioactions/mobile/AS_TitleBar_f32cc18519a749a59bb578c932852e95.js new file mode 100644 index 0000000..06f1c15 --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_TitleBar_f32cc18519a749a59bb578c932852e95.js @@ -0,0 +1,3 @@ +function AS_TitleBar_f32cc18519a749a59bb578c932852e95() { + return removeRestaurents.call(this); +} \ No newline at end of file diff --git a/SegementAnimation/studioactions/mobile/AS_TitleBar_f32cc18519a749a59bb578c932852e95.json b/SegementAnimation/studioactions/mobile/AS_TitleBar_f32cc18519a749a59bb578c932852e95.json new file mode 100644 index 0000000..36387eb --- /dev/null +++ b/SegementAnimation/studioactions/mobile/AS_TitleBar_f32cc18519a749a59bb578c932852e95.json @@ -0,0 +1,15 @@ +{ + "AS_TitleBar_f32cc18519a749a59bb578c932852e95": { + "id": "AS_TitleBar_f32cc18519a749a59bb578c932852e95", + "type": "ACTION_SEQUENCE", + "actions": [{ + "id": "INVOKE_FUNCTION___0fde0da76bf845968f0a687d42425372", + "type": "INVOKE_FUNCTION", + "sequenceKUID": "removeRestaurents", + "display": "removeRestaurents", + "inputparams": [], + "parentId": null, + "callbackType": null + }] + } +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/CopyFBox0431dcec4fd8f45.sm/CopyFBox0431dcec4fd8f45.json b/SegementAnimation/templates/mobile/segments/CopyFBox0431dcec4fd8f45.sm/CopyFBox0431dcec4fd8f45.json new file mode 100644 index 0000000..f914612 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/CopyFBox0431dcec4fd8f45.sm/CopyFBox0431dcec4fd8f45.json @@ -0,0 +1,48 @@ +{ + "DNDConfig": null, + "_height_": { + "type": "string", + "value": "70dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [], + "clipbounds": true, + "containerId": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "CopyFBox0431dcec4fd8f45", + "info": null, + "isGeneratedTemplate": true, + "isTemplate": true, + "isvisible": true, + "kuid": "562cf20ae57c4758a9c61d38996d698b", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "percent": true, + "pf": "CopyFBox0431dcec4fd8f45", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/CopyFBox071e8af1ebb8340.sm/CopyFBox071e8af1ebb8340.json b/SegementAnimation/templates/mobile/segments/CopyFBox071e8af1ebb8340.sm/CopyFBox071e8af1ebb8340.json new file mode 100644 index 0000000..207cd9b --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/CopyFBox071e8af1ebb8340.sm/CopyFBox071e8af1ebb8340.json @@ -0,0 +1,48 @@ +{ + "DNDConfig": null, + "_height_": { + "type": "string", + "value": "70dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [], + "clipbounds": true, + "containerId": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "CopyFBox071e8af1ebb8340", + "info": null, + "isGeneratedTemplate": true, + "isTemplate": true, + "isvisible": true, + "kuid": "f165ba8c50e74246ab0800fac978cbd0", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "percent": true, + "pf": "CopyFBox071e8af1ebb8340", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/FBox064a1b8498c1348.sm/FBox064a1b8498c1348.json b/SegementAnimation/templates/mobile/segments/FBox064a1b8498c1348.sm/FBox064a1b8498c1348.json new file mode 100644 index 0000000..ef320a6 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/FBox064a1b8498c1348.sm/FBox064a1b8498c1348.json @@ -0,0 +1,48 @@ +{ + "DNDConfig": null, + "_height_": { + "type": "string", + "value": "60dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [], + "clipbounds": true, + "containerId": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "FBox064a1b8498c1348", + "info": null, + "isGeneratedTemplate": true, + "isTemplate": true, + "isvisible": true, + "kuid": "30805474319b40bd90bdf015dc789306", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "percent": true, + "pf": "FBox064a1b8498c1348", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerDeleteBtn.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerDeleteBtn.json new file mode 100644 index 0000000..c948b3a --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerDeleteBtn.json @@ -0,0 +1,63 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "69dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "0dp" + }, + "_skin_": "s6323010ff8647d6b9b984cd9a3c438b", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "20%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "imgDelete" + ], + "clipbounds": true, + "containerId": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "FlexContainerDeleteBtn", + "ide_onClick": "AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf", + "info": null, + "isSegmentChild": false, + "isvisible": true, + "kuid": "038c1cd701cf45d9880812299689b23a", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "onclick": "AS_FlexContainer_bc024898cde84b94b16f917d8ab94faf", + "orientation": 6, + "parent": "FlexContainerFavorite", + "percent": true, + "pf": "favTemplate", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerFavorite.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerFavorite.json new file mode 100644 index 0000000..b0d4c0e --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerFavorite.json @@ -0,0 +1,51 @@ +{ + "DNDConfig": null, + "_height_": { + "type": "string", + "value": "70dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s35615a574064534b4718407c596bcf1", + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "lblLine", + "fcResDetails", + "FlexContainerDeleteBtn", + "FlexContainerMoreBtn" + ], + "clipbounds": true, + "containerId": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "FlexContainerFavorite", + "info": null, + "isSegmentChild": false, + "isTemplate": true, + "isvisible": true, + "kuid": "0a5f99b8b7a64b32b7604679e7b02808", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "favTemplate", + "percent": true, + "pf": "favTemplate", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerMoreBtn.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerMoreBtn.json new file mode 100644 index 0000000..e0c1a2f --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/FlexContainerMoreBtn.json @@ -0,0 +1,61 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "69dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "20%" + }, + "_skin_": "s1159656bb7b472188de67b9c7adcfec", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "20%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "imgMore" + ], + "clipbounds": true, + "containerId": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "FlexContainerMoreBtn", + "info": null, + "isSegmentChild": false, + "isvisible": true, + "kuid": "62c7604c0ec44e198d525f2aa8ca5002", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "FlexContainerFavorite", + "percent": true, + "pf": "favTemplate", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/favTemplate.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/favTemplate.json new file mode 100644 index 0000000..8dbca3e --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/favTemplate.json @@ -0,0 +1,63 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s3f768fd25ab44b297054cc4d6ed59a4", + "_title_": null, + "addWidgetsdone": false, + "allboxes": [], + "canUpdateUI": true, + "children": [ + "FlexContainerFavorite" + ], + "containerId": true, + "containerweight": 100, + "contentoffsetx": 0, + "contentoffsety": 0, + "contentsizeheight": 0, + "contentsizewidth": 0, + "currentLocale": null, + "device": "GalaxyS5", + "displayorientation": 3, + "enabled": false, + "enabledforidletimeout": false, + "id": "favTemplate", + "info": null, + "initdone": false, + "inputaccessoryviewtype": 4, + "intransitionconfig": { + "formTransition": "None" + }, + "isvisible": true, + "kuid": "a29bcabb4c6c4bb5b6f38a24217a57f4", + "name": "kony.ui.Form2", + "needappmenu": true, + "orientation": 1, + "outtransitionconfig": { + "formTransition": "None" + }, + "paddinginpixel": false, + "percent": true, + "platform": "android", + "prevDevice": "iPhone6", + "prevPlatform": "iphone", + "retainscrollposition": false, + "shellCSS": "and_GalaxyS5", + "titleBarSkin": "sa1f21944341431ebbcaa9421c715af9", + "titlebar": true, + "type": 3, + "wType": "Form", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/fcResDetails.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/fcResDetails.json new file mode 100644 index 0000000..ca1bdb1 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/fcResDetails.json @@ -0,0 +1,63 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "69dp" + }, + "_left_": { + "type": "string", + "value": "0%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s35615a574064534b4718407c596bcf1", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "imgResIcon", + "lblResName", + "lblResInfo" + ], + "clipbounds": true, + "containerId": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcResDetails", + "info": null, + "isSegmentChild": false, + "isvisible": true, + "kuid": "f24120d018184bbfa04bd20be944c753", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "FlexContainerFavorite", + "percent": true, + "pf": "favTemplate", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgDelete.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgDelete.json new file mode 100644 index 0000000..3befa1b --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgDelete.json @@ -0,0 +1,60 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizImage2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_base64_": null, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_left_": { + "type": "string", + "value": "1%" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s2b0664db7c74ba7911828e8ca032cd7", + "_src_": "delete.png", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "context": { + "channel": "mobile", + "platform": "android", + "templateType": "segments", + "topLevelBox": null + }, + "enabled": false, + "id": "imgDelete", + "imagescalemode": 1, + "info": null, + "invokedProperty": "src", + "isvisible": true, + "kuid": "44f37c5b118f4ab8840ff70dfd136667", + "name": "kony.ui.Image2", + "ontouchstart": "AS_Image_03289ea1a97941f2b212711370ecdef7", + "parent": "FlexContainerDeleteBtn", + "pf": "favTemplate", + "srcType": 1, + "wType": "Image", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgMore.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgMore.json new file mode 100644 index 0000000..117101b --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgMore.json @@ -0,0 +1,59 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizImage2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_base64_": null, + "_height_": { + "type": "ref", + "value": "preferred" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_right_": { + "type": "string", + "value": "0%" + }, + "_skin_": "s20cc00db3d44b0aac52504f4c78322f", + "_src_": "more.png", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "context": { + "channel": "mobile", + "platform": "android", + "templateType": "segments", + "topLevelBox": null + }, + "enabled": false, + "id": "imgMore", + "imagescalemode": 1, + "info": null, + "invokedProperty": "src", + "isvisible": true, + "kuid": "8ec06dcaf6d04da3b88be805216a145f", + "name": "kony.ui.Image2", + "parent": "FlexContainerMoreBtn", + "pf": "favTemplate", + "srcType": 1, + "wType": "Image", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgResIcon.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgResIcon.json new file mode 100644 index 0000000..0f284b1 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/imgResIcon.json @@ -0,0 +1,80 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizImage2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_base64_": null, + "_bottom_": { + "type": "string", + "value": "8dp" + }, + "_left_": { + "type": "string", + "value": "0dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s7266d3a030f4486ab5b5225a3e8f492", + "_src_": "imagedrag.png", + "_top_": { + "type": "string", + "value": "8dp" + }, + "_width_": { + "type": "string", + "value": "25%" + }, + "android": { + "render": true + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "context": { + "channel": "mobile", + "formID": "favTemplate", + "platform": "android", + "templateType": "segments", + "topLevelBox": null + }, + "enabled": false, + "id": "imgResIcon", + "imagescalemode": 1, + "info": null, + "iphone": { + "render": true + }, + "isvisible": true, + "kuid": "371000ae2671495f8a09ae208507849c", + "name": "kony.ui.Image2", + "parent": "fcResDetails", + "pf": "favTemplate", + "spaan": { + "render": true + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "srcType": 1, + "wType": "Image", + "widgetalignment": 5, + "winphone8": { + "render": true + } +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblLine.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblLine.json new file mode 100644 index 0000000..0fa917e --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblLine.json @@ -0,0 +1,83 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_bottom_": { + "type": "string", + "value": "0dp" + }, + "_height_": { + "type": "string", + "value": "1dp" + }, + "_left_": { + "type": "string", + "value": "5%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd22ede19b9441fa85f8bb2d65c0ebce", + "_text_": "", + "_width_": { + "type": "string", + "value": "95%" + }, + "_wrapping_": 2, + "android": { + "render": true + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "lblLine", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + }, + "render": true + }, + "isSegmentChild": false, + "isvisible": true, + "kuid": "3495ce29b6a14906947290bba0c20f4c", + "name": "kony.ui.Label", + "parent": "FlexContainerFavorite", + "pf": "favTemplate", + "spaan": { + "render": true + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "winphone8": { + "render": true + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblResInfo.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblResInfo.json new file mode 100644 index 0000000..a80d78f --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblResInfo.json @@ -0,0 +1,82 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "30dp" + }, + "_left_": { + "type": "string", + "value": "24%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s640691191cd482cbd666d5c184bdb4f", + "_text_": "Best Pizza", + "_top_": { + "type": "string", + "value": "28dp" + }, + "_width_": { + "type": "string", + "value": "79%" + }, + "_wrapping_": 2, + "android": { + "render": true + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "contentalignment": 1, + "enabled": false, + "id": "lblResInfo", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + }, + "render": true + }, + "isvisible": true, + "kuid": "cc8b2d68001f4cbf9bd515110cbe2a5b", + "name": "kony.ui.Label", + "parent": "fcResDetails", + "pf": "favTemplate", + "spaan": { + "render": true + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "winphone8": { + "render": true + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblResName.json b/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblResName.json new file mode 100644 index 0000000..cff16c6 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/favTemplate.sm/lblResName.json @@ -0,0 +1,82 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "28dp" + }, + "_left_": { + "type": "string", + "value": "24%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s6dad682e2fb4e42845eb92adab3e68e", + "_text_": "Dominos Pizza", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "79%" + }, + "_wrapping_": 2, + "android": { + "render": true + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "lblResName", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + }, + "render": true + }, + "isvisible": true, + "kuid": "a23fb7cc84634ea49fa0c7601a9a333d", + "name": "kony.ui.Label", + "parent": "fcResDetails", + "pf": "favTemplate", + "spaan": { + "render": true + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "winphone8": { + "render": true + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/resTemplate.sm/fcResDetailfcResDetail.json b/SegementAnimation/templates/mobile/segments/resTemplate.sm/fcResDetailfcResDetail.json new file mode 100644 index 0000000..4d32be6 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/resTemplate.sm/fcResDetailfcResDetail.json @@ -0,0 +1,65 @@ +{ + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "70dp" + }, + "_left_": { + "type": "string", + "value": "1dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s35615a574064534b4718407c596bcf1", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "100%" + }, + "allboxes": [], + "autogrowmode": 0, + "canUpdateUI": true, + "children": [ + "imgResIcon", + "lblResName", + "lblResInfo", + "lblLine" + ], + "clipbounds": true, + "containerId": true, + "containerweight": 100, + "enabled": false, + "enablescrolling": true, + "id": "fcResDetailfcResDetail", + "info": null, + "isSegmentChild": false, + "isTemplate": true, + "isvisible": true, + "kuid": "d61ac020ccf6433885b79da3e782021f", + "layouttype": 2, + "name": "kony.ui.FlexContainer", + "orientation": 6, + "parent": "resTemplate", + "percent": true, + "pf": "resTemplate", + "snapgridsize": 10, + "snaptogrid": true, + "wType": "FlexContainer", + "widgetalignment": 1, + "zindex": 10 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/resTemplate.sm/imgResIcon.json b/SegementAnimation/templates/mobile/segments/resTemplate.sm/imgResIcon.json new file mode 100644 index 0000000..5f0bc42 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/resTemplate.sm/imgResIcon.json @@ -0,0 +1,80 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizImage2", + "DNDConfig": null, + "__parentReadjusting__": false, + "_base64_": null, + "_bottom_": { + "type": "string", + "value": "8dp" + }, + "_left_": { + "type": "string", + "value": "0dp" + }, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s7266d3a030f4486ab5b5225a3e8f492", + "_src_": "imagedrag.png", + "_top_": { + "type": "string", + "value": "8dp" + }, + "_width_": { + "type": "string", + "value": "25%" + }, + "android": { + "render": true + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "context": { + "channel": "mobile", + "platform": "android", + "templateType": "segments", + "topLevelBox": null + }, + "enabled": false, + "id": "imgResIcon", + "imagescalemode": 1, + "info": null, + "iphone": { + "render": true + }, + "isSegmentChild": false, + "isvisible": true, + "kuid": "544c1b4ce015465b871e50edf423e550", + "name": "kony.ui.Image2", + "parent": "fcResDetailfcResDetail", + "pf": "resTemplate", + "spaan": { + "render": true + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "srcType": 1, + "wType": "Image", + "widgetalignment": 5, + "winphone8": { + "render": true + } +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblLine.json b/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblLine.json new file mode 100644 index 0000000..55c8c26 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblLine.json @@ -0,0 +1,83 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_bottom_": { + "type": "string", + "value": "1dp" + }, + "_height_": { + "type": "string", + "value": "1dp" + }, + "_left_": { + "type": "string", + "value": "5%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "sd22ede19b9441fa85f8bb2d65c0ebce", + "_text_": "", + "_width_": { + "type": "string", + "value": "95%" + }, + "_wrapping_": 2, + "android": { + "render": true + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "lblLine", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + }, + "render": true + }, + "isSegmentChild": false, + "isvisible": true, + "kuid": "2d60671013964759a8a562cc11695efc", + "name": "kony.ui.Label", + "parent": "fcResDetailfcResDetail", + "pf": "resTemplate", + "spaan": { + "render": true + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "winphone8": { + "render": true + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblResInfo.json b/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblResInfo.json new file mode 100644 index 0000000..a205816 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblResInfo.json @@ -0,0 +1,83 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "30dp" + }, + "_left_": { + "type": "string", + "value": "24%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s640691191cd482cbd666d5c184bdb4f", + "_text_": "Best Pizza", + "_top_": { + "type": "string", + "value": "28dp" + }, + "_width_": { + "type": "string", + "value": "79%" + }, + "_wrapping_": 2, + "android": { + "render": true + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "contentalignment": 1, + "enabled": false, + "id": "lblResInfo", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + }, + "render": true + }, + "isSegmentChild": false, + "isvisible": true, + "kuid": "6b9366f572ee4011af0c6b8d6b0c3b1a", + "name": "kony.ui.Label", + "parent": "fcResDetailfcResDetail", + "pf": "resTemplate", + "spaan": { + "render": true + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "winphone8": { + "render": true + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblResName.json b/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblResName.json new file mode 100644 index 0000000..79c6135 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/resTemplate.sm/lblResName.json @@ -0,0 +1,83 @@ +{ + "@class": "com.kony.gen.viz.model.component.KVizLabel", + "DNDConfig": null, + "__parentReadjusting__": false, + "_height_": { + "type": "string", + "value": "28dp" + }, + "_left_": { + "type": "string", + "value": "24%" + }, + "_margin_": [ + 1, + 1, + 1, + 1 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s6dad682e2fb4e42845eb92adab3e68e", + "_text_": "Dominos Pizza", + "_top_": { + "type": "string", + "value": "0dp" + }, + "_width_": { + "type": "string", + "value": "79%" + }, + "_wrapping_": 2, + "android": { + "render": true + }, + "canUpdateUI": true, + "containerId": true, + "containerweight": 100, + "contentalignment": 4, + "enabled": false, + "id": "lblResName", + "info": null, + "ipad": { + "psp": { + "wrapping": 2 + } + }, + "iphone": { + "psp": { + "wrapping": 2 + }, + "render": true + }, + "isSegmentChild": false, + "isvisible": true, + "kuid": "0cff35dcadc1497bb4887db8a61fecc3", + "name": "kony.ui.Label", + "parent": "fcResDetailfcResDetail", + "pf": "resTemplate", + "spaan": { + "render": true + }, + "spabb": { + "render": true + }, + "spaip": { + "render": true + }, + "spawinphone8": { + "render": true + }, + "tooltip": "", + "wType": "Label", + "widgetalignment": 5, + "winphone8": { + "render": true + }, + "zindex": 1 +} \ No newline at end of file diff --git a/SegementAnimation/templates/mobile/segments/resTemplate.sm/resTemplate.json b/SegementAnimation/templates/mobile/segments/resTemplate.sm/resTemplate.json new file mode 100644 index 0000000..77b0d18 --- /dev/null +++ b/SegementAnimation/templates/mobile/segments/resTemplate.sm/resTemplate.json @@ -0,0 +1,63 @@ +{ + "@class": "com.kony.gen.viz.model.container.KVizScrollFlexForm", + "DNDConfig": null, + "_margin_": [ + 0, + 0, + 0, + 0 + ], + "_padding_": [ + 0, + 0, + 0, + 0 + ], + "_render_": true, + "_skin_": "s3f768fd25ab44b297054cc4d6ed59a4", + "_title_": null, + "addWidgetsdone": false, + "allboxes": [], + "canUpdateUI": true, + "children": [ + "fcResDetailfcResDetail" + ], + "containerId": true, + "containerweight": 100, + "contentoffsetx": 0, + "contentoffsety": 0, + "contentsizeheight": 0, + "contentsizewidth": 0, + "currentLocale": null, + "device": "GalaxyS5", + "displayorientation": 3, + "enabled": false, + "enabledforidletimeout": false, + "id": "resTemplate", + "info": null, + "initdone": false, + "inputaccessoryviewtype": 4, + "intransitionconfig": { + "formTransition": "None" + }, + "isvisible": true, + "kuid": "2194f894e8b847eb93ea935ddbf808c7", + "name": "kony.ui.Form2", + "needappmenu": true, + "orientation": 1, + "outtransitionconfig": { + "formTransition": "None" + }, + "paddinginpixel": false, + "percent": true, + "platform": "android", + "prevDevice": "iPhone6", + "prevPlatform": "iphone", + "retainscrollposition": false, + "shellCSS": "and_GalaxyS5", + "titleBarSkin": "sa1f21944341431ebbcaa9421c715af9", + "titlebar": true, + "type": 3, + "wType": "Form", + "widgetalignment": 5 +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopysknLblResName045e8c8611e6742.json b/SegementAnimation/themes/defaultTheme/CopysknLblResName045e8c8611e6742.json new file mode 100644 index 0000000..a0cd5b1 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopysknLblResName045e8c8611e6742.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "00000000", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "3b3b3bff", + "font_name": "Helvetica", + "font_size": 115, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue-Bold" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "s2d7dd2a14fd4aeea075262fe93b300d", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "Label", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent018dca0afa70a43.json b/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent018dca0afa70a43.json new file mode 100644 index 0000000..1951531 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent018dca0afa70a43.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "ffffff00", + "bg_type": "one", + "border_color": "282828ff", + "border_style": "plain", + "border_type": 0, + "border_width": 1, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 125, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue-Light" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "sff06bb9c29d403d8920c7ef89af4295", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "TextField", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent0b7ed2d3726964c.json b/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent0b7ed2d3726964c.json new file mode 100644 index 0000000..95fcf07 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent0b7ed2d3726964c.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "ffffff00", + "bg_type": "one", + "border_color": "282828ff", + "border_style": "plain", + "border_type": 0, + "border_width": 1, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 125, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "s3f74dc47131483697260ee15d5b8107", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "TextField", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent0df9730f3551049.json b/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent0df9730f3551049.json new file mode 100644 index 0000000..2e0e20f --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyskntxtBoxTransparent0df9730f3551049.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "ffffff00", + "bg_type": "one", + "border_color": "282828ff", + "border_style": "plain", + "border_type": 0, + "border_width": 1, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 125, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "sf6923ce00b74d5aa25ad00ad0d7fa9c", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "TextField", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue09fd058fdc5de43.json b/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue09fd058fdc5de43.json new file mode 100644 index 0000000..ccaf2fa --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue09fd058fdc5de43.json @@ -0,0 +1,351 @@ +{ + "android": { + "background_image": "fav_btn.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "background_color": "56a9ddff", + "bg_type": "one", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_image": "fav_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_image": "fav_btn.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "iphone": { + "background_image": "fav_btn.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "isDefaultSkin": false, + "kiosk": { + "background_image": "fav_btn.png", + "bg_type": "image", + "isForked": true + }, + "kuid": "s209df1dae6345d1bd092598c8aefefe", + "spaan": { + "background_image": "fav_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_image": "fav_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "background_image": "fav_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_image": "fav_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_image": "fav_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_image": "fav_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_image": "fav_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_image": "fav_btn.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "wType": "Button", + "windows8": { + "background_image": "fav_btn.png", + "bg_type": "image", + "isForked": true + }, + "winphone8": { + "background_image": "fav_btn.png", + "bg_type": "image", + "isForked": true + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue09fd8a64d87a54a.json b/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue09fd8a64d87a54a.json new file mode 100644 index 0000000..9b2e4ae --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue09fd8a64d87a54a.json @@ -0,0 +1,351 @@ +{ + "android": { + "background_image": "map.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "background_color": "56a9ddff", + "bg_type": "one", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_image": "map.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_image": "map.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "iphone": { + "background_image": "map.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "isDefaultSkin": false, + "kiosk": { + "background_image": "map.png", + "bg_type": "image", + "isForked": true + }, + "kuid": "s4421c4ead6b4206af0a6d250d683745", + "spaan": { + "background_image": "map.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_image": "map.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "background_image": "map.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_image": "map.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_image": "map.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_image": "map.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_image": "map.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_image": "map.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "wType": "Button", + "windows8": { + "background_image": "map.png", + "bg_type": "image", + "isForked": true + }, + "winphone8": { + "background_image": "map.png", + "bg_type": "image", + "isForked": true + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue0a02b99fcfa324b.json b/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue0a02b99fcfa324b.json new file mode 100644 index 0000000..9f34ad8 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslButtonGlossBlue0a02b99fcfa324b.json @@ -0,0 +1,351 @@ +{ + "android": { + "background_image": "rate_btn.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "background_color": "56a9ddff", + "bg_type": "one", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_image": "rate_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_image": "rate_btn.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "iphone": { + "background_image": "rate_btn.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "isDefaultSkin": false, + "kiosk": { + "background_image": "rate_btn.png", + "bg_type": "image", + "isForked": true + }, + "kuid": "s5caf4d408bb44edbb82b91e6ff8dc11", + "spaan": { + "background_image": "rate_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_image": "rate_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "background_image": "rate_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_image": "rate_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_image": "rate_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_image": "rate_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_image": "rate_btn.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_image": "rate_btn.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "wType": "Button", + "windows8": { + "background_image": "rate_btn.png", + "bg_type": "image", + "isForked": true + }, + "winphone8": { + "background_image": "rate_btn.png", + "bg_type": "image", + "isForked": true + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslCheckBoxGroup02255eba9b57f4c.json b/SegementAnimation/themes/defaultTheme/CopyslCheckBoxGroup02255eba9b57f4c.json new file mode 100644 index 0000000..3e68c4a --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslCheckBoxGroup02255eba9b57f4c.json @@ -0,0 +1,77 @@ +{ + "android": { + "font_size": 135, + "isForked": false + }, + "background_color": "ffffff00", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "font_size": 135, + "isForked": false + }, + "fontSizeInPx": false, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 135, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_size": 135, + "isForked": false + }, + "iphone": { + "font_size": 135, + "isForked": false + }, + "isDefaultSkin": false, + "kiosk": { + "font_size": 135, + "isForked": false + }, + "kuid": "s5b2fed8d01b44c0b3ee4216a7a6e9f0", + "spaan": { + "font_size": 135, + "isForked": false + }, + "spaandroidtablet": { + "font_size": 135, + "isForked": false + }, + "spabb": { + "font_size": 135, + "isForked": false + }, + "spaip": { + "font_size": 135, + "isForked": false + }, + "spaipad": { + "font_size": 135, + "isForked": false + }, + "spawindowstablet": { + "font_size": 135, + "isForked": false + }, + "spawinphone8": { + "font_size": 135, + "isForked": false + }, + "tabrcandroid": { + "font_size": 135, + "isForked": false + }, + "wType": "CheckBoxGroup", + "windows8": { + "font_size": 135, + "isForked": false + }, + "winphone8": { + "font_size": 135, + "isForked": false + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslFbox0086419b4203c47.json b/SegementAnimation/themes/defaultTheme/CopyslFbox0086419b4203c47.json new file mode 100644 index 0000000..50cec47 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslFbox0086419b4203c47.json @@ -0,0 +1,11 @@ +{ + "background_color": "8c8c8cff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "se5b17d84ae74516bb73601eaa03efd1", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslFbox00a1947e3dabe44.json b/SegementAnimation/themes/defaultTheme/CopyslFbox00a1947e3dabe44.json new file mode 100644 index 0000000..dc9ca0d --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslFbox00a1947e3dabe44.json @@ -0,0 +1,11 @@ +{ + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "s523746e0aab4a629989ea5bb38588ca", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslFbox03e3a32a868074b.json b/SegementAnimation/themes/defaultTheme/CopyslFbox03e3a32a868074b.json new file mode 100644 index 0000000..3799f2f --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslFbox03e3a32a868074b.json @@ -0,0 +1,11 @@ +{ + "background_color": "c8c7cdff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "s1159656bb7b472188de67b9c7adcfec", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslFbox063d5f1221dbe45.json b/SegementAnimation/themes/defaultTheme/CopyslFbox063d5f1221dbe45.json new file mode 100644 index 0000000..a9df0e2 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslFbox063d5f1221dbe45.json @@ -0,0 +1,11 @@ +{ + "background_color": "00000000", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "sba0942aaee046f885a9edc4ac9cb06f", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslFbox07d54c4a2afb847.json b/SegementAnimation/themes/defaultTheme/CopyslFbox07d54c4a2afb847.json new file mode 100644 index 0000000..e132c2e --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslFbox07d54c4a2afb847.json @@ -0,0 +1,11 @@ +{ + "background_color": "00000000", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "sbfea841f69f43849d8a9c9fd2b58287", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslFbox082a7709b02c94e.json b/SegementAnimation/themes/defaultTheme/CopyslFbox082a7709b02c94e.json new file mode 100644 index 0000000..91599ca --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslFbox082a7709b02c94e.json @@ -0,0 +1,11 @@ +{ + "background_color": "000000ff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "sff628cfef80494da73a8688c9adbf15", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslFbox0d8bdeb6f08034a.json b/SegementAnimation/themes/defaultTheme/CopyslFbox0d8bdeb6f08034a.json new file mode 100644 index 0000000..91c9caa --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslFbox0d8bdeb6f08034a.json @@ -0,0 +1,11 @@ +{ + "background_color": "e13b30ff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "s6323010ff8647d6b9b984cd9a3c438b", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslForm04f9d73dc7c6242.json b/SegementAnimation/themes/defaultTheme/CopyslForm04f9d73dc7c6242.json new file mode 100644 index 0000000..22004ae --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslForm04f9d73dc7c6242.json @@ -0,0 +1,8 @@ +{ + "background_color": "ffffffff", + "bg_type": "one", + "border_color": "ffffffff", + "isDefaultSkin": false, + "kuid": "sd2e07fe9bea4747b0f1ed397d7b7b9c", + "wType": "Form" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslForm05966cc6673a94c.json b/SegementAnimation/themes/defaultTheme/CopyslForm05966cc6673a94c.json new file mode 100644 index 0000000..755a7c8 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslForm05966cc6673a94c.json @@ -0,0 +1,8 @@ +{ + "background_color": "333f4aff", + "bg_type": "one", + "border_color": "ffffffff", + "isDefaultSkin": false, + "kuid": "s022080a14dd40cda4e250c21494af71", + "wType": "Form" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslForm0ac569e5c635f47.json b/SegementAnimation/themes/defaultTheme/CopyslForm0ac569e5c635f47.json new file mode 100644 index 0000000..099341f --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslForm0ac569e5c635f47.json @@ -0,0 +1,8 @@ +{ + "background_color": "333f4aff", + "bg_type": "one", + "border_color": "ffffffff", + "isDefaultSkin": false, + "kuid": "s4c239ca064c41f29fafc526d710bcd6", + "wType": "Form" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslImage0600bbe78227141.json b/SegementAnimation/themes/defaultTheme/CopyslImage0600bbe78227141.json new file mode 100644 index 0000000..fa11641 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslImage0600bbe78227141.json @@ -0,0 +1,16 @@ +{ + "background_color": "e13b30ff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "000000ff", + "font_name": "Helvetica", + "font_size": 157, + "font_style": "normal", + "font_weight": "normal", + "isDefaultSkin": false, + "kuid": "s2b0664db7c74ba7911828e8ca032cd7", + "wType": "Image" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslImage0ede7e1c7d54e43.json b/SegementAnimation/themes/defaultTheme/CopyslImage0ede7e1c7d54e43.json new file mode 100644 index 0000000..fce47d1 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslImage0ede7e1c7d54e43.json @@ -0,0 +1,16 @@ +{ + "background_color": "c8c7cd00", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "000000ff", + "font_name": "Helvetica", + "font_size": 157, + "font_style": "normal", + "font_weight": "normal", + "isDefaultSkin": false, + "kuid": "s20cc00db3d44b0aac52504f4c78322f", + "wType": "Image" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslTitleBar040a4d808174a4c.json b/SegementAnimation/themes/defaultTheme/CopyslTitleBar040a4d808174a4c.json new file mode 100644 index 0000000..cb049cc --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslTitleBar040a4d808174a4c.json @@ -0,0 +1,11 @@ +{ + "background_color": "333f4aff", + "bg_type": "one", + "font_color": "ffffff", + "font_name": "Arial, Helvetica, sans-serif", + "font_size": 125, + "font_weight": "normal", + "isDefaultSkin": false, + "kuid": "sf4e9c0e12b141698a1823eef22b7e95", + "wType": "TitleBar" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/CopyslTitleBar0c16b8f1fc7ad42.json b/SegementAnimation/themes/defaultTheme/CopyslTitleBar0c16b8f1fc7ad42.json new file mode 100644 index 0000000..2c5cc33 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/CopyslTitleBar0c16b8f1fc7ad42.json @@ -0,0 +1,11 @@ +{ + "background_color": "333f4aff", + "bg_type": "one", + "font_color": "333333", + "font_name": "Arial, Helvetica, sans-serif", + "font_size": "100", + "font_weight": "normal", + "isDefaultSkin": false, + "kuid": "sc462c7010984420b397059aa18665b1", + "wType": "TitleBar" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/seg2Focus.json b/SegementAnimation/themes/defaultTheme/seg2Focus.json new file mode 100644 index 0000000..919c05b --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/seg2Focus.json @@ -0,0 +1,11 @@ +{ + "background_color": "00000000", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": true, + "kuid": "sf73da56dc46443ab1168dd77d3a92c3", + "wType": "Segment" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/seg2Normal.json b/SegementAnimation/themes/defaultTheme/seg2Normal.json new file mode 100644 index 0000000..a550dbf --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/seg2Normal.json @@ -0,0 +1,11 @@ +{ + "background_color": "ffffffff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": true, + "kuid": "s1cf81e2c5814641983ca7e23b3eaf61", + "wType": "Segment" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknBtnFavorites.json b/SegementAnimation/themes/defaultTheme/sknBtnFavorites.json new file mode 100644 index 0000000..197eae4 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknBtnFavorites.json @@ -0,0 +1,476 @@ +{ + "android": { + "background_image": "favorites.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "background_image": "favorites.png", + "bg_type": "image", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "iphone": { + "background_image": "favorites.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "isDefaultSkin": false, + "kuid": "sdd47edd6a7e432cac77a6db8b170ee3", + "spaan": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "wType": "Button" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknBtnLogin.json b/SegementAnimation/themes/defaultTheme/sknBtnLogin.json new file mode 100644 index 0000000..05ff11b --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknBtnLogin.json @@ -0,0 +1,401 @@ +{ + "android": { + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "00a3d9ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "font_name": "Helvetica", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_color": "00a3d9ff", + "bg_type": "one", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "00a3d9ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "iphone": { + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "00a3d9ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "font_name": "HelveticaNeue", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "isDefaultSkin": false, + "kiosk": { + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "00a3d9ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "font_name": "GenericMonospace", + "isForked": true + }, + "kuid": "s087bdfb0dc44c83b52049fe9c659880", + "spaan": { + "background_color": "00a3d9ff", + "bg_type": "one", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_color": "00a3d9ff", + "bg_type": "one", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "background_color": "00a3d9ff", + "bg_type": "one", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_color": "00a3d9ff", + "bg_type": "one", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_color": "00a3d9ff", + "bg_type": "one", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_color": "00a3d9ff", + "bg_type": "one", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_color": "00a3d9ff", + "bg_type": "one", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "font_name": "Helvetica", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "00a3d9ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "font_name": "Helvetica", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "wType": "Button", + "windows8": { + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "00a3d9ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "font_name": "GenericMonospace", + "isForked": true + }, + "winphone8": { + "background_color": "00a3d9ff", + "bg_type": "one", + "border_color": "00a3d9ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "font_name": "GenericMonospace", + "isForked": true + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknBtnLogout.json b/SegementAnimation/themes/defaultTheme/sknBtnLogout.json new file mode 100644 index 0000000..c871c30 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknBtnLogout.json @@ -0,0 +1,351 @@ +{ + "android": { + "background_image": "logout.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "background_image": "logout.png", + "bg_type": "image", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_image": "logout.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_image": "logout.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "iphone": { + "background_image": "logout.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "isDefaultSkin": false, + "kiosk": { + "background_image": "logout.png", + "bg_type": "image", + "isForked": true + }, + "kuid": "s7fcaddf95a142beb8775f2a55566133", + "spaan": { + "background_image": "logout.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_image": "logout.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "background_image": "logout.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_image": "logout.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_image": "logout.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_image": "logout.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_image": "logout.png", + "bg_type": "image", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_image": "logout.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "wType": "Button", + "windows8": { + "background_image": "logout.png", + "bg_type": "image", + "isForked": true + }, + "winphone8": { + "background_image": "logout.png", + "bg_type": "image", + "isForked": true + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknBtnbackTitle.json b/SegementAnimation/themes/defaultTheme/sknBtnbackTitle.json new file mode 100644 index 0000000..5b7f167 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknBtnbackTitle.json @@ -0,0 +1,476 @@ +{ + "android": { + "background_image": "back.png", + "bg_type": "image", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "background_image": "back.png", + "bg_type": "image", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "iphone": { + "background_image": "back.png", + "bg_type": "image", + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "isDefaultSkin": false, + "kuid": "sd2728eeba0d4770a5cdfd653687dc21", + "spaan": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "nm": 0, + "x": 0, + "y": 0 + } + }, + "wType": "Button" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknFCTrans.json b/SegementAnimation/themes/defaultTheme/sknFCTrans.json new file mode 100644 index 0000000..3677cd0 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknFCTrans.json @@ -0,0 +1,11 @@ +{ + "background_color": "ffffff00", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "s124443cda9b4ef0bb37a58dd078d59e", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknFCgrey.json b/SegementAnimation/themes/defaultTheme/sknFCgrey.json new file mode 100644 index 0000000..abfdc3a --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknFCgrey.json @@ -0,0 +1,267 @@ +{ + "android": { + "border_color": "2b2938ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "isForked": true + }, + "background_color": "2b2938ff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "bottom_left_border_color": "000000ff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "000000ff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "000000ff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "000000ff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "ipad": { + "border_color": "2b2938ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + } + }, + "iphone": { + "border_color": "2b2938ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + } + }, + "isDefaultSkin": false, + "kiosk": { + "border_color": "2b2938ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "isForked": true + }, + "kuid": "s2f38d7817d2498c9a7910d8385fca87", + "spaan": { + "bottom_left_border_color": "000000ff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "000000ff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "000000ff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "000000ff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "bottom_left_border_color": "000000ff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "000000ff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "000000ff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "000000ff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "bottom_left_border_color": "000000ff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "000000ff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "000000ff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "000000ff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "bottom_left_border_color": "000000ff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "000000ff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "000000ff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "000000ff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "bottom_left_border_color": "000000ff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "000000ff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "000000ff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "000000ff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "bottom_left_border_color": "000000ff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "000000ff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "000000ff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "000000ff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "bottom_left_border_color": "000000ff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "000000ff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 0, + "color": "000000", + "inner": false, + "nm": 0, + "x": 0, + "y": 0 + }, + "top_left_border_color": "000000ff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "000000ff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "border_color": "2b2938ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "isForked": true + }, + "wType": "FlexContainer", + "windows8": { + "border_color": "2b2938ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "isForked": true + }, + "winphone8": { + "border_color": "2b2938ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "isForked": true + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknFCtitleGrey.json b/SegementAnimation/themes/defaultTheme/sknFCtitleGrey.json new file mode 100644 index 0000000..6b65aec --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknFCtitleGrey.json @@ -0,0 +1,11 @@ +{ + "background_color": "333f4aff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "s9ec461af5054f12aacda4e3128c37b7", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknFlexContainerLightGrey.json b/SegementAnimation/themes/defaultTheme/sknFlexContainerLightGrey.json new file mode 100644 index 0000000..a48fe62 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknFlexContainerLightGrey.json @@ -0,0 +1,11 @@ +{ + "background_color": "f1f1f1ff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "s9bf40c1918e452ba896b3f9fc73bef9", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknFlexContainerWhite.json b/SegementAnimation/themes/defaultTheme/sknFlexContainerWhite.json new file mode 100644 index 0000000..a2fe7fc --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknFlexContainerWhite.json @@ -0,0 +1,11 @@ +{ + "background_color": "ffffffff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": false, + "kuid": "s35615a574064534b4718407c596bcf1", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknFrmBGGrey.json b/SegementAnimation/themes/defaultTheme/sknFrmBGGrey.json new file mode 100644 index 0000000..010868a --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknFrmBGGrey.json @@ -0,0 +1,8 @@ +{ + "background_color": "333f4aff", + "bg_type": "one", + "border_color": "ffffffff", + "isDefaultSkin": false, + "kuid": "sdbd55e7cae843d6a4be4c4213bf20bd", + "wType": "Form" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblFrmTitle.json b/SegementAnimation/themes/defaultTheme/sknLblFrmTitle.json new file mode 100644 index 0000000..12f261e --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblFrmTitle.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "00000000", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 130, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "s5c84e75663846cbb45ff536a4d1d473", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "Label", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblLine.json b/SegementAnimation/themes/defaultTheme/sknLblLine.json new file mode 100644 index 0000000..4eb1bc9 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblLine.json @@ -0,0 +1,16 @@ +{ + "background_color": "c8c7ccff", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "424242ff", + "font_name": "Helvetica", + "font_size": 214, + "font_style": "normal", + "font_weight": "normal", + "isDefaultSkin": false, + "kuid": "sd22ede19b9441fa85f8bb2d65c0ebce", + "wType": "Label" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblRating.json b/SegementAnimation/themes/defaultTheme/sknLblRating.json new file mode 100644 index 0000000..ce952cf --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblRating.json @@ -0,0 +1,62 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "427b06ff", + "bg_type": "one", + "border_color": "427b06ff", + "border_radius": 3, + "border_style": "custom", + "border_type": 0, + "border_width": 1, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 100, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "Helvetica" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "s56fc185c4d94b5d8275c5784733327a", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "Label", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblResInfo.json b/SegementAnimation/themes/defaultTheme/sknLblResInfo.json new file mode 100644 index 0000000..69ca8f7 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblResInfo.json @@ -0,0 +1,19 @@ +{ + "background_color": "00000000", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "929292ff", + "font_name": "Helvetica", + "font_size": 110, + "font_style": "normal", + "font_weight": "bold", + "iphone": { + "font_name": "HelveticaNeue" + }, + "isDefaultSkin": false, + "kuid": "s640691191cd482cbd666d5c184bdb4f", + "wType": "Label" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblResName.json b/SegementAnimation/themes/defaultTheme/sknLblResName.json new file mode 100644 index 0000000..cc15011 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblResName.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "00000000", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "3b3b3bff", + "font_name": "Helvetica", + "font_size": 120, + "font_style": "normal", + "font_weight": "bold", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "s6dad682e2fb4e42845eb92adab3e68e", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "Label", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblResNameWhite.json b/SegementAnimation/themes/defaultTheme/sknLblResNameWhite.json new file mode 100644 index 0000000..5af5574 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblResNameWhite.json @@ -0,0 +1,19 @@ +{ + "background_color": "00000000", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 150, + "font_style": "normal", + "font_weight": "bold", + "iphone": { + "font_name": "HelveticaNeue" + }, + "isDefaultSkin": false, + "kuid": "s0758ad4ce30450481351de40691ef2b", + "wType": "Label" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblSeparator.json b/SegementAnimation/themes/defaultTheme/sknLblSeparator.json new file mode 100644 index 0000000..22c7e0a --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblSeparator.json @@ -0,0 +1,16 @@ +{ + "background_color": "ffffffff", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "424242ff", + "font_name": "Helvetica", + "font_size": 214, + "font_style": "normal", + "font_weight": "normal", + "isDefaultSkin": false, + "kuid": "s04e5a267fa94758804e482dee84c71a", + "wType": "Label" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblTitle2.json b/SegementAnimation/themes/defaultTheme/sknLblTitle2.json new file mode 100644 index 0000000..194788d --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblTitle2.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "00000000", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 132, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue-Light" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "sd9ad9741a874054b9afe4e58a4fa01e", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "Label", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLblTittle1.json b/SegementAnimation/themes/defaultTheme/sknLblTittle1.json new file mode 100644 index 0000000..755de0b --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLblTittle1.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "00000000", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 130, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue-Light" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "s1d944ace0be4558a04188cf0e2f5dbd", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "Label", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sknLoading.json b/SegementAnimation/themes/defaultTheme/sknLoading.json new file mode 100644 index 0000000..8f8d339 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sknLoading.json @@ -0,0 +1,14 @@ +{ + "android": { + "isForked": true + }, + "background_color": "c0c0c0ff", + "bg_type": "one", + "border_color": "ffffffff", + "iphone": { + "isForked": true + }, + "isDefaultSkin": false, + "kuid": "s056b14587c64e17ab9986d04d167f42", + "wType": "Form" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/skntxtBoxTransparent.json b/SegementAnimation/themes/defaultTheme/skntxtBoxTransparent.json new file mode 100644 index 0000000..d3a5f39 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/skntxtBoxTransparent.json @@ -0,0 +1,61 @@ +{ + "android": { + "font_name": "Helvetica" + }, + "background_color": "ffffff00", + "bg_type": "one", + "border_color": "282828ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "font_name": "Helvetica" + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 125, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "font_name": "Helvetica" + }, + "iphone": { + "font_name": "HelveticaNeue-Light" + }, + "isDefaultSkin": false, + "kiosk": { + "font_name": "GenericMonospace" + }, + "kuid": "s796ebfbfb3347ab89809d8748b589ea", + "spaan": { + "font_name": "Helvetica" + }, + "spaandroidtablet": { + "font_name": "Helvetica" + }, + "spabb": { + "font_name": "Helvetica" + }, + "spaip": { + "font_name": "Helvetica" + }, + "spaipad": { + "font_name": "Helvetica" + }, + "spawindowstablet": { + "font_name": "Helvetica" + }, + "spawinphone8": { + "font_name": "Helvetica" + }, + "tabrcandroid": { + "font_name": "Helvetica" + }, + "wType": "TextField", + "windows8": { + "font_name": "GenericMonospace" + }, + "winphone8": { + "font_name": "GenericMonospace" + } +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slButtonGlossBlue.json b/SegementAnimation/themes/defaultTheme/slButtonGlossBlue.json new file mode 100644 index 0000000..14adde4 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slButtonGlossBlue.json @@ -0,0 +1,492 @@ +{ + "android": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + } + }, + "background_color": "56a9ddff", + "bg_type": "one", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + } + }, + "iphone": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + } + }, + "isDefaultSkin": true, + "kuid": "s6d535603ce146388ebc34afc428e69a", + "spaan": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spabb": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_color": { + "angle": 0, + "colors": [ + "56a9ddff", + "3a83a7ff", + "4aa8d1ff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + } + }, + "wType": "Button" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slButtonGlossRed.json b/SegementAnimation/themes/defaultTheme/slButtonGlossRed.json new file mode 100644 index 0000000..912e77d --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slButtonGlossRed.json @@ -0,0 +1,447 @@ +{ + "android": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + } + }, + "background_color": "d62c3aff", + "bg_type": "one", + "border_color": "ffffffff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "desktopweb": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "font_color": "ffffffff", + "font_name": "Helvetica", + "font_size": 146, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + } + }, + "iphone": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + } + }, + "isDefaultSkin": true, + "kuid": "s4e0322e4f174715887416830e0a11a1", + "spaan": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaandroidtablet": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaip": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spaipad": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawindowstablet": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "spawinphone8": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "bottom_left_border_color": "ffffffff", + "bottom_left_border_style": "plain", + "bottom_left_border_width": 0, + "bottom_right_border_color": "ffffffff", + "bottom_right_border_style": "plain", + "bottom_right_border_width": 0, + "isForked": true, + "shadow": { + "br": 2, + "color": "000000ff", + "inner": false, + "nm": 0, + "x": 0, + "y": 2 + }, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + }, + "top_left_border_color": "ffffffff", + "top_left_border_style": "plain", + "top_left_border_width": 0, + "top_right_border_color": "ffffffff", + "top_right_border_style": "plain", + "top_right_border_width": 0 + }, + "tabrcandroid": { + "background_color": { + "angle": 0, + "colors": [ + "d62c3aff", + "bd1421ff", + "dd878dff" + ], + "cs": [ + 0, + 50, + 100 + ], + "gt": "linear" + }, + "background_style": "linear", + "bg_type": "ms_gradient", + "isForked": true, + "text_shadow": { + "br": 0, + "color": "000000ff", + "x": 0, + "y": -1 + } + }, + "wType": "Button" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slCheckBoxGroup.json b/SegementAnimation/themes/defaultTheme/slCheckBoxGroup.json new file mode 100644 index 0000000..1d90046 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slCheckBoxGroup.json @@ -0,0 +1,16 @@ +{ + "background_color": "ffffffff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "000000ff", + "font_name": "Helvetica", + "font_size": 157, + "font_style": "normal", + "font_weight": "normal", + "isDefaultSkin": true, + "kuid": "s052b3cd01e847cbac8f3c82c5c09f91", + "wType": "CheckBoxGroup" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slFbox.json b/SegementAnimation/themes/defaultTheme/slFbox.json new file mode 100644 index 0000000..098ae52 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slFbox.json @@ -0,0 +1,11 @@ +{ + "background_color": "00000000", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": true, + "kuid": "s4f017ed309a499eb0c21235e28f53dd", + "wType": "FlexContainer" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slForm.json b/SegementAnimation/themes/defaultTheme/slForm.json new file mode 100644 index 0000000..a2cb028 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slForm.json @@ -0,0 +1 @@ +{"background_color":"7e7e7e","bg_type":"one","border_color":"ffffffff","isDefaultSkin":true,"kuid":"s3f768fd25ab44b297054cc4d6ed59a4","wType":"Form"} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slImage.json b/SegementAnimation/themes/defaultTheme/slImage.json new file mode 100644 index 0000000..7e9a5f7 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slImage.json @@ -0,0 +1,16 @@ +{ + "background_color": "00000000", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "000000ff", + "font_name": "Helvetica", + "font_size": 157, + "font_style": "normal", + "font_weight": "normal", + "isDefaultSkin": true, + "kuid": "s7266d3a030f4486ab5b5225a3e8f492", + "wType": "Image" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slLabel.json b/SegementAnimation/themes/defaultTheme/slLabel.json new file mode 100644 index 0000000..10b4334 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slLabel.json @@ -0,0 +1,16 @@ +{ + "background_color": "00000000", + "bg_type": "one", + "border_color": "424242ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_color": "424242ff", + "font_name": "Helvetica", + "font_size": 214, + "font_style": "normal", + "font_weight": "normal", + "isDefaultSkin": true, + "kuid": "s74fc5c0ae1146debb92b69e2d425da1", + "wType": "Label" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slPopup.json b/SegementAnimation/themes/defaultTheme/slPopup.json new file mode 100644 index 0000000..872db3d --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slPopup.json @@ -0,0 +1 @@ +{"background_color":"7e7e7e","bg_type":"one","isDefaultSkin":true,"kuid":"s9523e23b86e47efaefde54c46e584d4","wType":"Popup"} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slSwitch.json b/SegementAnimation/themes/defaultTheme/slSwitch.json new file mode 100644 index 0000000..c6cdeb8 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slSwitch.json @@ -0,0 +1,26 @@ +{ + "background_left_color": "48d874ff", + "background_right_color": "ffffff00", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "font_name": "Helvetica", + "font_size": 156, + "font_style": "normal", + "font_weight": "normal", + "ipad": { + "thumb_color": "ffffff", + "tint_color": "e8e8e8" + }, + "iphone": { + "thumb_color": "ffffff", + "tint_color": "e8e8e8" + }, + "isDefaultSkin": true, + "kuid": "se5d8a4c61f740409e8c4698805b454b", + "left_font_color": "ffffffff", + "right_font_color": "ffffffff", + "wType": "Switch" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slTextBox.json b/SegementAnimation/themes/defaultTheme/slTextBox.json new file mode 100644 index 0000000..c551e71 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slTextBox.json @@ -0,0 +1,16 @@ +{ + "background_color": "ffffffff", + "bg_type": "one", + "border_color": "282828ff", + "border_style": "plain", + "border_type": 0, + "border_width": 1, + "font_color": "555555ff", + "font_name": "Helvetica", + "font_size": 125, + "font_style": "normal", + "font_weight": "normal", + "isDefaultSkin": true, + "kuid": "sae29db4d43042679be3638ec1cbec07", + "wType": "TextField" +} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/slTitleBar.json b/SegementAnimation/themes/defaultTheme/slTitleBar.json new file mode 100644 index 0000000..487b483 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/slTitleBar.json @@ -0,0 +1 @@ +{"bg_type":"one","background_color":"ffffff","font_size":"100","font_color":"333333","font_name":"Arial, Helvetica, sans-serif","font_weight":"normal","wType":"TitleBar","kuid":"sa1f21944341431ebbcaa9421c715af9","isDefaultSkin":true} \ No newline at end of file diff --git a/SegementAnimation/themes/defaultTheme/sliPhoneSegmentHeader.json b/SegementAnimation/themes/defaultTheme/sliPhoneSegmentHeader.json new file mode 100644 index 0000000..1e69c17 --- /dev/null +++ b/SegementAnimation/themes/defaultTheme/sliPhoneSegmentHeader.json @@ -0,0 +1,11 @@ +{ + "background_color": "a7a7a7ff", + "bg_type": "one", + "border_color": "000000ff", + "border_style": "plain", + "border_type": 0, + "border_width": 0, + "isDefaultSkin": true, + "kuid": "s5dcf5786ff140d0a6444670d4071291", + "wType": "Segment" +} \ No newline at end of file diff --git a/SegementAnimation/widgetinfo.properties b/SegementAnimation/widgetinfo.properties new file mode 100644 index 0000000..69178be --- /dev/null +++ b/SegementAnimation/widgetinfo.properties @@ -0,0 +1,97 @@ +# +#Thu Oct 29 13:24:36 IST 2015 +mobile$0$frmDetails=form2 +mobile$0$frmDetails.fcBtnrate=flexcontainer +mobile$0$frmLogin.CheckBoxGroup0b0f5d1875e364d=checkboxgroup +mobile$0$frmLogin.txtBoxUserPswd=textfield +mobile$0$fcResDetailfcResDetail.lblResName=label +mobile$0$FlexContainerFavorite.lblResName=label +mobile$0$frmFavorite.fcTitle=flexcontainer +mobile$0$frmLogin.txtBoxUserId=textfield +mobile$0$frmtest.btnLogout=button +mobile$0$frmMap=form2 +mobile$0$frmDetails.CopyLabel0322dbd3661fd43=label +mobile$0$frmtest.fcTitle=flexcontainer +mobile$0$frmLogin=form2 +mobile$0$FlexContainerFavorite.imgMore=image +mobile$0$frmDetails.btnMap=button +mobile$0$frmDetails.fcTitle=flexcontainer +mobile$0$frmDetails.fcBtnFavorite=flexcontainer +mobile$0$frmHome.segmentRestaurentList=segui +mobile$0$frmDetails.FlexContainer01dc4e76c44b04f=flexcontainer +mobile$0$FlexContainerFavorite.imgDelete=image +mobile$0$frmHome.fcTitle=flexcontainer +mobile$0$frmtest=form2 +mobile$0$frmDetails.fcResDetailsContainer=flexcontainer +mobile$0$frmDetails.fcFrmDetailsContainer=flexcontainer +mobile$0$frmMap.Map045d7344df01044=map +mobile$0$frmLogin.imgicon1=image +mobile$0$frmFavorite=form2 +mobile$0$frmLogin.btnLogin=button +mobile$0$Form00a240e66adfc4e=form2 +mobile$0$Form00a240e66adfc4e.Button0ce1d574251ee4e=button +mobile$0$frmLogin.fcSwitch=flexcontainer +mobile$0$/SegementAnimation/templates/mobile/segments/favTemplate=segui +mobile$0$/SegementAnimation/templates/mobile/segments/CopyFBox0431dcec4fd8f45=segui +mobile$0$frmDetails.lblAddress=label +mobile$0$frmDetails.btnRate=button +mobile$0$frmFavorite.btnLogout=button +mobile$0$frmFavorite.segFavRestaurents=segui +mobile$0$frmFavorite.btnBack=button +mobile$0$frmDetails.Label07788dc95418f42=label +mobile$0$frmHome.Button0243bef6030b74d=button +mobile$0$FlexContainerFavorite.fcResDetails=flexcontainer +mobile$0$frmDetails.imgRestaurent=image +mobile$0$frmLogin.Switch03dcb15500a7f43=switch +mobile$0$FlexContainerFavorite.FlexContainerDeleteBtn=flexcontainer +mobile$0$frmDetails.lblCuisinesDetails=label +mobile$0$frmDetails.CopyLabel06c60a4883e2f45=label +mobile$0$frmLogin.lblSwitch=label +mobile$0$frmLogin.imgLogo=image +mobile$0$fcResDetailfcResDetail.lblResInfo=label +mobile$0$frmLogin.imgIcon=image +mobile$0$FlexContainerFavorite.lblResInfo=label +mobile$0$frmDetails.btnFavorite=button +mobile$0$frmtest.btnBack=button +mobile$0$frmLogin.lblSeparator=label +mobile$0$frmDetails.fcAddress=flexcontainer +mobile$0$frmDetails.lblCusines=label +mobile$0$frmHome.lblTitle=label +mobile$0$frmHome.btnFavorites=button +mobile$0$frmHome.btnLogout=button +mobile$0$frmLogin.fcUserId=flexcontainer +mobile$0$frmDetails.fcCuisins=flexcontainer +mobile$0$fcResDetailfcResDetail.imgResIcon=image +mobile$0$frmHome.FlexContainer0ccecc465000a43=flexcontainer +mobile$0$FlexContainerFavorite.imgResIcon=image +mobile$0$FlexContainerFavorite.lblLine=label +mobile$0$frmDetails.lblTitle=label +mobile$0$frmFavorite.fcFrmContainer=flexcontainer +mobile$0$frmDetails.btnBack=button +mobile$0$fcResDetailfcResDetail.lblLine=label +mobile$0$FlexContainerFavorite.FlexContainerMoreBtn=flexcontainer +mobile$0$/SegementAnimation/templates/mobile/segments/FBox064a1b8498c1348=segui +mobile$0$frmDetails.CopylblCusines0e87c021cdaac4c=label +mobile$0$frmtest.lblTitle=label +mobile$0$frmtest.fcFrmContainer=flexcontainer +mobile$0$frmDetails.lblRating=label +mobile$0$frmLogin.loginContainer=flexcontainer +mobile$0$frmLogin.CopylblSeparator0ba52bbe93a644a=label +mobile$0$frmDetails.btnLogout=button +mobile$0$frmtest.segFavRestaurents=segui +mobile$0$frmFavorite.lblTitle=label +mobile$0$fcResDetailfcResDetail=flexcontainer +mobile$0$frmLogin.lblTitle2=label +mobile$0$frmDetails.fcResDetails=flexcontainer +mobile$0$/SegementAnimation/templates/mobile/segments/resTemplate=segui +mobile$0$frmLogin.lblTitle1=label +mobile$0$frmDetails.CopylblCuisinesDetails0b742884ef22f43=label +mobile$0$FlexContainerFavorite=flexcontainer +mobile$0$/SegementAnimation/templates/mobile/segments/CopyFBox071e8af1ebb8340=segui +mobile$0$frmDetails.CopylblCusines0386b0e110fbf40=label +mobile$0$frmHome=form2 +mobile$0$frmLogin.fcUserPswd=flexcontainer +mobile$0$frmDetails.fcCost=flexcontainer +mobile$0$frmHome.Button077b6130fce3d46=button +mobile$0$frmDetails.lblResAdd=label +mobile$0$frmDetails.lblResName=label diff --git a/SegementAnimation/windowsViews.xml b/SegementAnimation/windowsViews.xml new file mode 100644 index 0000000..c8ff10b --- /dev/null +++ b/SegementAnimation/windowsViews.xml @@ -0,0 +1 @@ + \ No newline at end of file