Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishna Vemulavada
/
vera_2.1_app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b1352af9
authored
Sep 15, 2016
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added Local DB table for storing Variable form views and Variable choice values.
parent
3af6f1d6
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
784 additions
and
60 deletions
app/src/main/java/com/vsoft/uoflservicenow/api/listeners/get/GetCatalogueVariableApiListener.java
app/src/main/java/com/vsoft/uoflservicenow/api/managers/CatalogueVariableApiManager.java
app/src/main/java/com/vsoft/uoflservicenow/api/managers/VariableChoiceManager.java
app/src/main/java/com/vsoft/uoflservicenow/db/DBManager.java
app/src/main/java/com/vsoft/uoflservicenow/db/managers/CatalogueVariableManager.java
app/src/main/java/com/vsoft/uoflservicenow/db/models/CatalogueVariable.java
app/src/main/java/com/vsoft/uoflservicenow/db/models/VariableChoice.java
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueItemScreen.java
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueScreen.java
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
app/src/main/java/com/vsoft/uoflservicenow/utils/Constants.java
app/src/main/java/com/vsoft/uoflservicenow/utils/DBConstants.java
app/src/main/java/com/vsoft/uoflservicenow/utils/Util.java
app/src/main/java/com/vsoft/uoflservicenow/api/listeners/get/GetCatalogueVariableApiListener.java
View file @
b1352af9
package
com
.
vsoft
.
uoflservicenow
.
api
.
listeners
.
get
;
package
com
.
vsoft
.
uoflservicenow
.
api
.
listeners
.
get
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariable
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariable
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariableSet
;
import
java.util.List
;
import
java.util.List
;
...
@@ -11,5 +10,5 @@ import java.util.List;
...
@@ -11,5 +10,5 @@ import java.util.List;
*
*
*/
*/
public
interface
GetCatalogueVariableApiListener
{
public
interface
GetCatalogueVariableApiListener
{
void
onDoneApiCall
(
List
<
CatalogueVariable
Set
>
variableSetList
,
List
<
CatalogueVariable
>
variableList
);
void
onDoneApiCall
(
List
<
CatalogueVariable
>
variableList
);
}
}
app/src/main/java/com/vsoft/uoflservicenow/api/managers/CatalogueVariableApiManager.java
View file @
b1352af9
...
@@ -94,6 +94,7 @@ public class CatalogueVariableApiManager {
...
@@ -94,6 +94,7 @@ public class CatalogueVariableApiManager {
JSONObject
catalogueJsonObject
=
jsonArray
.
getJSONObject
(
0
);
JSONObject
catalogueJsonObject
=
jsonArray
.
getJSONObject
(
0
);
JSONArray
variableSetJsonArray
=
catalogueJsonObject
.
getJSONArray
(
Constants
.
RESPONSE_VARIABLE_SET_OBJECT_NAME
);
JSONArray
variableSetJsonArray
=
catalogueJsonObject
.
getJSONArray
(
Constants
.
RESPONSE_VARIABLE_SET_OBJECT_NAME
);
List
<
CatalogueVariableSet
>
variableSetList
=
new
ArrayList
<>(
variableSetJsonArray
.
length
());
List
<
CatalogueVariableSet
>
variableSetList
=
new
ArrayList
<>(
variableSetJsonArray
.
length
());
List
<
CatalogueVariable
>
finalVariableList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
variableSetJsonArray
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
variableSetJsonArray
.
length
();
i
++)
{
JSONObject
variableSetJsonObject
=
variableSetJsonArray
.
getJSONObject
(
i
);
JSONObject
variableSetJsonObject
=
variableSetJsonArray
.
getJSONObject
(
i
);
CatalogueVariableSet
catalogueVariableSet
=
gson
.
fromJson
(
variableSetJsonObject
.
toString
(),
CatalogueVariableSet
.
class
);
CatalogueVariableSet
catalogueVariableSet
=
gson
.
fromJson
(
variableSetJsonObject
.
toString
(),
CatalogueVariableSet
.
class
);
...
@@ -140,9 +141,19 @@ public class CatalogueVariableApiManager {
...
@@ -140,9 +141,19 @@ public class CatalogueVariableApiManager {
return
(
lhs
.
getOrder
()
-
rhs
.
getOrder
());
return
(
lhs
.
getOrder
()
-
rhs
.
getOrder
());
}
}
});
});
listener
.
onDoneApiCall
(
variableSetList
,
variableList
);
/*For variableset */
for
(
int
i
=
0
;
i
<
variableSetList
.
size
();
i
++)
{
CatalogueVariableSet
catalogueVariableSet
=
variableSetList
.
get
(
i
);
finalVariableList
.
addAll
(
catalogueVariableSet
.
getVariables
());
}
/*For variable list*/
finalVariableList
.
addAll
(
variableList
);
listener
.
onDoneApiCall
(
finalVariableList
);
}
else
{
}
else
{
listener
.
onDoneApiCall
(
new
ArrayList
<
CatalogueVariable
Set
>(
0
),
new
ArrayList
<
CatalogueVariable
>(
0
));
listener
.
onDoneApiCall
(
new
ArrayList
<
CatalogueVariable
>(
0
));
}
}
return
SyncStatus
.
SUCCESS
;
return
SyncStatus
.
SUCCESS
;
}
else
}
else
...
...
app/src/main/java/com/vsoft/uoflservicenow/api/managers/VariableChoiceManager.java
0 → 100644
View file @
b1352af9
package
com
.
vsoft
.
uoflservicenow
.
api
.
managers
;
import
android.content.ContentValues
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteDatabase
;
import
com.vsoft.uoflservicenow.CatalogueApplication
;
import
com.vsoft.uoflservicenow.db.models.VariableChoice
;
import
com.vsoft.uoflservicenow.utils.DBConstants
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author Kunj on 11-08-2016.
*/
public
class
VariableChoiceManager
implements
DBConstants
{
public
static
long
save
(
VariableChoice
variableChoice
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
long
id
=
db
.
insert
(
TABLE_VARIABLE_CHOICES
,
null
,
getContentValues
(
variableChoice
));
variableChoice
.
setId
(
id
);
return
id
;
}
else
{
return
-
1
;
}
}
public
static
int
delete
(
VariableChoice
variableChoice
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
return
db
.
delete
(
TABLE_VARIABLE_CHOICES
,
VARIABLE_CHOICE_ID
+
"="
+
variableChoice
.
getId
(),
null
);
}
return
-
1
;
}
public
static
void
deleteAll
(
long
variableId
)
{
List
<
VariableChoice
>
localVariableChoiceList
=
getAllVariableChoices
(
variableId
);
if
(!
localVariableChoiceList
.
isEmpty
())
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
for
(
int
i
=
0
;
i
<
localVariableChoiceList
.
size
();
i
++)
{
delete
(
localVariableChoiceList
.
get
(
i
));
}
}
}
}
public
static
void
handleGetVariableChoice
(
long
variableId
,
List
<
VariableChoice
>
serverVariableChoiceList
)
{
if
(
serverVariableChoiceList
!=
null
&&
!
serverVariableChoiceList
.
isEmpty
())
{
/*First delete all existing variable choice for particular variable then we will save*/
deleteAll
(
variableId
);
for
(
int
i
=
0
;
i
<
serverVariableChoiceList
.
size
();
i
++)
{
VariableChoice
variableChoice
=
serverVariableChoiceList
.
get
(
i
);
variableChoice
.
setVariableId
(
variableId
);
save
(
variableChoice
);
}
}
else
{
/*That means there is no VariableChoice in server response,
*then all local items should be deleted those are contain that variable id*/
/*localVariableChoiceList is contain all local Catalogues */
deleteAll
(
variableId
);
}
}
public
static
List
<
VariableChoice
>
getAllVariableChoices
(
long
variableId
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
Cursor
c
=
db
.
rawQuery
(
"select * from "
+
TABLE_VARIABLE_CHOICES
+
" where "
+
VARIABLE_CHOICE_VARIABLE_ID
+
"="
+
variableId
+
" ORDER BY "
+
VARIABLE_CHOICE_ORDER
+
" ASC"
,
null
);
ArrayList
<
VariableChoice
>
variableChoiceList
;
if
(
c
.
getCount
()
>
0
)
{
variableChoiceList
=
new
ArrayList
<>(
c
.
getCount
());
while
(
c
.
moveToNext
())
{
VariableChoice
.
VariableChoiceBuilder
builder
=
VariableChoice
.
VariableChoiceBuilder
.
aVariableChoice
();
fillAllVariableChoiceDetails
(
c
,
builder
);
variableChoiceList
.
add
(
builder
.
build
());
}
}
else
{
variableChoiceList
=
new
ArrayList
<>(
0
);
}
c
.
close
();
return
variableChoiceList
;
}
else
{
return
new
ArrayList
<>(
0
);
}
}
public
static
VariableChoice
get
(
long
variableChoiceId
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
VariableChoice
variableChoice
=
null
;
if
(
db
!=
null
)
{
Cursor
c
=
db
.
rawQuery
(
"select * from "
+
TABLE_VARIABLE_CHOICES
+
" where "
+
VARIABLE_CHOICE_ID
+
"="
+
variableChoiceId
,
null
);
if
(
c
.
moveToFirst
())
{
VariableChoice
.
VariableChoiceBuilder
builder
=
VariableChoice
.
VariableChoiceBuilder
.
aVariableChoice
();
fillAllVariableChoiceDetails
(
c
,
builder
);
variableChoice
=
builder
.
build
();
}
c
.
close
();
}
return
variableChoice
;
}
private
static
void
fillAllVariableChoiceDetails
(
Cursor
c
,
VariableChoice
.
VariableChoiceBuilder
builder
)
{
builder
.
setId
(
c
.
getLong
(
INDEX_VARIABLE_CHOICE_ID
));
builder
.
setVariableId
((
c
.
getLong
(
INDEX_VARIABLE_CHOICE_VARIABLE_ID
)));
builder
.
setText
(
c
.
getString
(
INDEX_VARIABLE_CHOICE_TEXT
));
builder
.
setValue
(
c
.
getString
(
INDEX_VARIABLE_CHOICE_VALUE
));
builder
.
setOrder
(
c
.
getInt
(
INDEX_VARIABLE_CHOICE_ORDER
));
builder
.
setMisc
(
c
.
getFloat
(
INDEX_VARIABLE_CHOICE_MISC
));
}
private
static
ContentValues
getContentValues
(
VariableChoice
variableChoice
)
{
ContentValues
cv
=
new
ContentValues
(
VARIABLE_CHOICE_COLUMN_COUNT
-
1
);
cv
.
put
(
VARIABLE_CHOICE_VARIABLE_ID
,
variableChoice
.
getVariableId
());
cv
.
put
(
VARIABLE_CHOICE_TEXT
,
variableChoice
.
getText
());
cv
.
put
(
VARIABLE_CHOICE_VALUE
,
variableChoice
.
getValue
());
cv
.
put
(
VARIABLE_CHOICE_ORDER
,
variableChoice
.
getOrder
());
cv
.
put
(
VARIABLE_CHOICE_MISC
,
variableChoice
.
getMisc
());
return
cv
;
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uoflservicenow/db/DBManager.java
View file @
b1352af9
...
@@ -29,6 +29,8 @@ public class DBManager extends SQLiteOpenHelper implements DBConstants {
...
@@ -29,6 +29,8 @@ public class DBManager extends SQLiteOpenHelper implements DBConstants {
public
void
onCreate
(
SQLiteDatabase
db
)
{
public
void
onCreate
(
SQLiteDatabase
db
)
{
createCatalogueTable
(
db
);
createCatalogueTable
(
db
);
createCatalogueItemsTable
(
db
);
createCatalogueItemsTable
(
db
);
createVariableTable
(
db
);
createVariableChoiceTable
(
db
);
}
}
@Override
@Override
...
@@ -64,4 +66,31 @@ public class DBManager extends SQLiteOpenHelper implements DBConstants {
...
@@ -64,4 +66,31 @@ public class DBManager extends SQLiteOpenHelper implements DBConstants {
+
CATALOGUE_ITEM_SYNC_DIRTY
+
" integer default "
+
SYNC_FLAG_NONE
+
CATALOGUE_ITEM_SYNC_DIRTY
+
" integer default "
+
SYNC_FLAG_NONE
+
");"
);
+
");"
);
}
}
private
void
createVariableTable
(
SQLiteDatabase
db
)
{
db
.
execSQL
(
"create table "
+
TABLE_CATALOGUE_VARIABLES
+
"("
+
CATALOGUE_VARIABLE_ID
+
" integer primary key autoincrement, "
+
CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
+
" integer default -1, "
+
CATALOGUE_VARIABLE_SYS_ID
+
" text, "
+
CATALOGUE_VARIABLE_NAME
+
" text, "
+
CATALOGUE_VARIABLE_QUESTION_TEXT
+
" text, "
+
CATALOGUE_VARIABLE_TYPE
+
" integer, "
+
CATALOGUE_VARIABLE_MANDATORY
+
" integer, "
+
CATALOGUE_VARIABLE_NONE_REQUIRED
+
" integer, "
+
CATALOGUE_VARIABLE_REFERENCE_TABLE
+
" text, "
+
CATALOGUE_VARIABLE_ORDER
+
" text, "
+
CATALOGUE_VARIABLE_REFERENCE_COLUMN_NAME
+
" text, "
+
CATALOGUE_VARIABLE_SYNC_DIRTY
+
" integer default "
+
SYNC_FLAG_NONE
+
");"
);
}
private
void
createVariableChoiceTable
(
SQLiteDatabase
db
)
{
db
.
execSQL
(
"create table "
+
TABLE_VARIABLE_CHOICES
+
"("
+
VARIABLE_CHOICE_ID
+
" integer primary key autoincrement, "
+
VARIABLE_CHOICE_VARIABLE_ID
+
" integer default -1, "
+
VARIABLE_CHOICE_TEXT
+
" text, "
+
VARIABLE_CHOICE_VALUE
+
" integer, "
+
VARIABLE_CHOICE_ORDER
+
" integer, "
+
VARIABLE_CHOICE_MISC
+
" real);"
);
}
}
}
app/src/main/java/com/vsoft/uoflservicenow/db/managers/CatalogueVariableManager.java
0 → 100644
View file @
b1352af9
package
com
.
vsoft
.
uoflservicenow
.
db
.
managers
;
import
android.content.ContentValues
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteDatabase
;
import
com.vsoft.uoflservicenow.CatalogueApplication
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariable
;
import
com.vsoft.uoflservicenow.enums.ViewType
;
import
com.vsoft.uoflservicenow.utils.DBConstants
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
/**
*
* @author Kunj on 11-08-2016.
*/
public
class
CatalogueVariableManager
implements
DBConstants
{
public
static
long
save
(
CatalogueVariable
catalogueVariable
,
int
syncDirty
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
catalogueVariable
.
setSyncDirty
(
syncDirty
);
long
id
=
db
.
insert
(
TABLE_CATALOGUE_VARIABLES
,
null
,
getContentValues
(
catalogueVariable
));
catalogueVariable
.
setId
(
id
);
return
id
;
}
else
{
return
-
1
;
}
}
public
static
int
delete
(
CatalogueVariable
catalogueVariable
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
if
(
catalogueVariable
.
getSysId
()
==
null
||
catalogueVariable
.
getSysId
().
isEmpty
())
{
return
db
.
delete
(
TABLE_CATALOGUE_VARIABLES
,
CATALOGUE_VARIABLE_ID
+
"="
+
catalogueVariable
.
getId
(),
null
);
}
else
{
return
update
(
catalogueVariable
,
SYNC_FLAG_DELETE
);
}
}
return
-
1
;
}
public
static
int
update
(
CatalogueVariable
catalogueVariable
,
int
syncDirty
)
{
return
update
(
catalogueVariable
,
null
,
syncDirty
);
}
public
static
int
update
(
CatalogueVariable
catalogueVariable
,
List
<
String
>
column
,
int
syncDirty
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
catalogueVariable
.
setSyncDirty
(
syncDirty
);
if
(
column
==
null
||
column
.
size
()
==
0
)
{
return
db
.
update
(
TABLE_CATALOGUE_VARIABLES
,
getContentValues
(
catalogueVariable
),
CATALOGUE_VARIABLE_ID
+
"="
+
catalogueVariable
.
getId
(),
null
);
}
else
{
ContentValues
contentValues
=
new
ContentValues
(
column
.
size
());
contentValues
.
put
(
CATALOGUE_VARIABLE_SYNC_DIRTY
,
catalogueVariable
.
getSyncDirty
());
for
(
int
i
=
0
;
i
<
column
.
size
();
i
++)
{
String
columnName
=
column
.
get
(
i
);
if
(
CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
,
catalogueVariable
.
getCatalogueItemId
());
}
else
if
(
CATALOGUE_VARIABLE_SYS_ID
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_SYS_ID
,
catalogueVariable
.
getSysId
());
}
else
if
(
CATALOGUE_VARIABLE_NAME
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_NAME
,
catalogueVariable
.
getName
());
}
else
if
(
CATALOGUE_VARIABLE_QUESTION_TEXT
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_QUESTION_TEXT
,
catalogueVariable
.
getQuestionText
());
}
else
if
(
CATALOGUE_VARIABLE_TYPE
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_TYPE
,
ViewType
.
getId
(
catalogueVariable
.
getType
()));
}
else
if
(
CATALOGUE_VARIABLE_MANDATORY
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_MANDATORY
,
catalogueVariable
.
isMandatory
()
?
1
:
0
);
}
else
if
(
CATALOGUE_VARIABLE_NONE_REQUIRED
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_NONE_REQUIRED
,
catalogueVariable
.
isNoneRequired
()
?
1
:
0
);
}
else
if
(
CATALOGUE_VARIABLE_REFERENCE_TABLE
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_REFERENCE_TABLE
,
catalogueVariable
.
getReferenceTable
());
}
else
if
(
CATALOGUE_VARIABLE_ORDER
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_ORDER
,
catalogueVariable
.
getOrder
());
}
else
if
(
CATALOGUE_VARIABLE_REFERENCE_COLUMN_NAME
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_REFERENCE_COLUMN_NAME
,
catalogueVariable
.
getReferenceColumnName
());
}
else
if
(
CATALOGUE_VARIABLE_SYNC_DIRTY
.
equals
(
columnName
))
{
contentValues
.
put
(
CATALOGUE_VARIABLE_SYNC_DIRTY
,
catalogueVariable
.
getSyncDirty
());
}
}
return
db
.
update
(
TABLE_CATALOGUE_VARIABLES
,
contentValues
,
CATALOGUE_VARIABLE_ID
+
"="
+
catalogueVariable
.
getId
(),
null
);
}
}
else
{
return
-
1
;
}
}
public
static
void
handleGetVariable
(
long
catalogueItemId
,
List
<
CatalogueVariable
>
serverVariableList
)
{
if
(
serverVariableList
!=
null
&&
!
serverVariableList
.
isEmpty
())
{
/*variableSysIdMap contain all server response catalogues Sys Id*/
HashMap
<
String
,
Integer
>
variableSysIdMap
=
new
HashMap
<>(
0
);
Integer
intObj
=
Integer
.
valueOf
(
1
);
for
(
int
i
=
0
;
i
<
serverVariableList
.
size
();
i
++)
{
String
sysId
=
serverVariableList
.
get
(
i
).
getSysId
();
variableSysIdMap
.
put
(
sysId
,
intObj
);
}
/*localVariableList is contain all local Catalogues */
List
<
CatalogueVariable
>
localVariableList
=
getAllVariable
(
catalogueItemId
);
if
(
localVariableList
!=
null
&&
!
localVariableList
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
localVariableList
.
size
();
i
++)
{
CatalogueVariable
localVariable
=
localVariableList
.
get
(
i
);
String
localVariableSysId
=
localVariable
.
getSysId
();
if
(
localVariableSysId
!=
null
&&
!
localVariableSysId
.
isEmpty
()
&&
!
variableSysIdMap
.
containsKey
(
localVariableSysId
))
{
//Update sys_id with empty string because required to delete locally
localVariable
.
setSysId
(
""
);
delete
(
localVariable
);
}
}
}
/*Check this catalogueVariable is exist in local DB or not
* If doesn't exist in local, save it
* If exist in local, update the local item with data from server item.
* */
for
(
int
i
=
0
;
i
<
serverVariableList
.
size
();
i
++)
{
CatalogueVariable
catalogueVariable
=
serverVariableList
.
get
(
i
);
CatalogueVariable
localVariable
=
getVariableFromSysId
(
catalogueItemId
,
catalogueVariable
.
getSysId
());
if
(
localVariable
==
null
)
{
catalogueVariable
.
setCatalogueItemId
(
catalogueItemId
);
save
(
catalogueVariable
,
DBConstants
.
SYNC_FLAG_NONE
);
}
else
{
/*Update complete local CatalogueVariable object with response CatalogueVariable object*/
catalogueVariable
.
setId
(
localVariable
.
getId
());
catalogueVariable
.
setCatalogueItemId
(
catalogueItemId
);
update
(
catalogueVariable
,
DBConstants
.
SYNC_FLAG_NONE
);
}
}
}
else
{
/*That means there is no CatalogueVariable in server response, then all local items should be deleted those are contain sys_id*/
/*localVariableList is contain all local Catalogues */
List
<
CatalogueVariable
>
localVariableList
=
getAllVariable
(
catalogueItemId
);
if
(
localVariableList
!=
null
&&
!
localVariableList
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
localVariableList
.
size
();
i
++)
{
CatalogueVariable
localVariable
=
localVariableList
.
get
(
i
);
String
localVariableSysId
=
localVariable
.
getSysId
();
if
(
localVariableSysId
!=
null
&&
!
localVariableSysId
.
isEmpty
())
{
//Update sys_id with empty string because required to delete locally
localVariable
.
setSysId
(
""
);
delete
(
localVariable
);
}
}
}
}
}
public
static
List
<
CatalogueVariable
>
getAllVariable
(
long
catalogueItemId
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
if
(
db
!=
null
)
{
Cursor
c
=
db
.
rawQuery
(
"select * from "
+
TABLE_CATALOGUE_VARIABLES
+
" where "
+
CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
+
"="
+
catalogueItemId
+
" and "
+
CATALOGUE_VARIABLE_SYNC_DIRTY
+
"!="
+
DBConstants
.
SYNC_FLAG_DELETE
,
null
);
ArrayList
<
CatalogueVariable
>
variableList
;
if
(
c
.
getCount
()
>
0
)
{
variableList
=
new
ArrayList
<>(
c
.
getCount
());
while
(
c
.
moveToNext
())
{
CatalogueVariable
.
CatalogueVariableBuilder
builder
=
CatalogueVariable
.
CatalogueVariableBuilder
.
aCatalogueVariable
();
fillAllVariableDetails
(
c
,
builder
);
variableList
.
add
(
builder
.
build
());
}
}
else
{
variableList
=
new
ArrayList
<>(
0
);
}
c
.
close
();
return
variableList
;
}
else
{
return
new
ArrayList
<>(
0
);
}
}
public
static
CatalogueVariable
get
(
long
catalogueId
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
CatalogueVariable
catalogueVariable
=
null
;
if
(
db
!=
null
)
{
Cursor
c
=
db
.
rawQuery
(
"select * from "
+
TABLE_CATALOGUE_VARIABLES
+
" where "
+
CATALOGUE_VARIABLE_ID
+
"="
+
catalogueId
,
null
);
if
(
c
.
moveToFirst
())
{
CatalogueVariable
.
CatalogueVariableBuilder
builder
=
CatalogueVariable
.
CatalogueVariableBuilder
.
aCatalogueVariable
();
fillAllVariableDetails
(
c
,
builder
);
catalogueVariable
=
builder
.
build
();
}
c
.
close
();
}
return
catalogueVariable
;
}
public
static
CatalogueVariable
getVariableFromSysId
(
long
catalogueItemId
,
String
sysId
)
{
SQLiteDatabase
db
=
CatalogueApplication
.
getDatabase
();
CatalogueVariable
catalogueVariable
=
null
;
if
(
db
!=
null
)
{
Cursor
c
=
db
.
rawQuery
(
"select * from "
+
TABLE_CATALOGUE_VARIABLES
+
" where "
+
CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
+
"="
+
catalogueItemId
+
" and "
+
CATALOGUE_VARIABLE_SYS_ID
+
"='"
+
sysId
+
"'"
,
null
);
if
(
c
.
moveToFirst
())
{
CatalogueVariable
.
CatalogueVariableBuilder
builder
=
CatalogueVariable
.
CatalogueVariableBuilder
.
aCatalogueVariable
();
fillAllVariableDetails
(
c
,
builder
);
catalogueVariable
=
builder
.
build
();
}
c
.
close
();
}
return
catalogueVariable
;
}
private
static
void
fillAllVariableDetails
(
Cursor
c
,
CatalogueVariable
.
CatalogueVariableBuilder
builder
)
{
builder
.
setId
(
c
.
getLong
(
INDEX_CATALOGUE_VARIABLE_ID
));
builder
.
setCatalogueItemId
(
c
.
getLong
(
INDEX_CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
));
builder
.
setSysId
(
c
.
getString
(
INDEX_CATALOGUE_VARIABLE_SYS_ID
));
builder
.
setName
(
c
.
getString
(
INDEX_CATALOGUE_VARIABLE_NAME
));
builder
.
setQuestionText
(
c
.
getString
(
INDEX_CATALOGUE_VARIABLE_QUESTION_TEXT
));
builder
.
setType
(
ViewType
.
from
(
c
.
getInt
(
INDEX_CATALOGUE_VARIABLE_TYPE
)));
builder
.
setMandatory
(
c
.
getInt
(
INDEX_CATALOGUE_VARIABLE_MANDATORY
)
==
1
);
builder
.
setNoneRequired
(
c
.
getInt
(
INDEX_CATALOGUE_VARIABLE_NONE_REQUIRED
)
==
1
);
builder
.
setReferenceTable
(
c
.
getString
(
INDEX_CATALOGUE_VARIABLE_REFERENCE
));
builder
.
setOrder
(
c
.
getInt
(
INDEX_CATALOGUE_VARIABLE_ORDER
));
builder
.
setReferenceColumnName
(
c
.
getString
(
INDEX_CATALOGUE_VARIABLE_REFERENCE_COLUMN_NAME
));
builder
.
setSyncDirty
(
c
.
getInt
(
INDEX_CATALOGUE_VARIABLE_SYNC_DIRTY
));
}
private
static
ContentValues
getContentValues
(
CatalogueVariable
catalogueVariable
)
{
ContentValues
cv
=
new
ContentValues
(
CATALOGUE_VARIABLE_COLUMN_COUNT
-
1
);
cv
.
put
(
CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
,
catalogueVariable
.
getCatalogueItemId
());
cv
.
put
(
CATALOGUE_VARIABLE_SYS_ID
,
catalogueVariable
.
getSysId
());
cv
.
put
(
CATALOGUE_VARIABLE_NAME
,
catalogueVariable
.
getName
());
cv
.
put
(
CATALOGUE_VARIABLE_QUESTION_TEXT
,
catalogueVariable
.
getQuestionText
());
cv
.
put
(
CATALOGUE_VARIABLE_TYPE
,
catalogueVariable
.
getType
().
getId
());
cv
.
put
(
CATALOGUE_VARIABLE_MANDATORY
,
catalogueVariable
.
isMandatory
()
?
1
:
0
);
cv
.
put
(
CATALOGUE_VARIABLE_NONE_REQUIRED
,
catalogueVariable
.
isNoneRequired
()
?
1
:
0
);
cv
.
put
(
CATALOGUE_VARIABLE_REFERENCE_TABLE
,
catalogueVariable
.
getReferenceTable
());
cv
.
put
(
CATALOGUE_VARIABLE_ORDER
,
catalogueVariable
.
getOrder
());
cv
.
put
(
CATALOGUE_VARIABLE_REFERENCE_COLUMN_NAME
,
catalogueVariable
.
getReferenceColumnName
());
cv
.
put
(
CATALOGUE_VARIABLE_SYNC_DIRTY
,
catalogueVariable
.
getSyncDirty
());
return
cv
;
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uoflservicenow/db/models/CatalogueVariable.java
View file @
b1352af9
...
@@ -18,6 +18,9 @@ import java.util.List;
...
@@ -18,6 +18,9 @@ import java.util.List;
*/
*/
public
class
CatalogueVariable
{
public
class
CatalogueVariable
{
private
long
id
=
-
1
;
private
long
catalogue_item_id
=
-
1
;
@SerializedName
(
"name"
)
@SerializedName
(
"name"
)
@Expose
@Expose
private
String
name
;
private
String
name
;
...
@@ -47,8 +50,25 @@ public class CatalogueVariable {
...
@@ -47,8 +50,25 @@ public class CatalogueVariable {
// @Expose
// @Expose
private
ViewType
type
;
private
ViewType
type
;
private
int
syncDirty
;
private
List
<
VariableChoice
>
mVariableChoiceList
;
private
List
<
VariableChoice
>
mVariableChoiceList
;
public
long
getId
()
{
return
id
;
}
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
long
getCatalogueItemId
()
{
return
catalogue_item_id
;
}
public
void
setCatalogueItemId
(
long
catalogue_item_id
)
{
this
.
catalogue_item_id
=
catalogue_item_id
;
}
/**
/**
*
*
* @return
* @return
...
@@ -161,6 +181,14 @@ public class CatalogueVariable {
...
@@ -161,6 +181,14 @@ public class CatalogueVariable {
this
.
referenceColumnName
=
referenceColumnName
;
this
.
referenceColumnName
=
referenceColumnName
;
}
}
public
int
getSyncDirty
()
{
return
syncDirty
;
}
public
void
setSyncDirty
(
int
syncDirty
)
{
this
.
syncDirty
=
syncDirty
;
}
public
List
<
VariableChoice
>
getVariableChoiceList
()
{
public
List
<
VariableChoice
>
getVariableChoiceList
()
{
return
mVariableChoiceList
;
return
mVariableChoiceList
;
}
}
...
@@ -212,6 +240,109 @@ public class CatalogueVariable {
...
@@ -212,6 +240,109 @@ public class CatalogueVariable {
this
.
setType
(
ViewType
.
from
(
viewType
));
this
.
setType
(
ViewType
.
from
(
viewType
));
}
}
public
static
final
class
CatalogueVariableBuilder
{
private
long
id
=
-
1
;
private
long
catalogue_item_id
=
-
1
;
private
String
name
;
private
String
questionText
;
private
String
sysId
;
private
boolean
isNoneRequired
;
private
boolean
mandatory
;
private
String
referenceTable
;
private
int
order
;
private
String
referenceColumnName
;
private
ViewType
type
;
private
int
syncDirty
;
private
CatalogueVariableBuilder
()
{
}
public
static
CatalogueVariableBuilder
aCatalogueVariable
()
{
return
new
CatalogueVariableBuilder
();
}
public
CatalogueVariableBuilder
setId
(
long
id
)
{
this
.
id
=
id
;
return
this
;
}
public
CatalogueVariableBuilder
setCatalogueItemId
(
long
catalogue_item_id
)
{
this
.
catalogue_item_id
=
catalogue_item_id
;
return
this
;
}
public
CatalogueVariableBuilder
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
CatalogueVariableBuilder
setQuestionText
(
String
questionText
)
{
this
.
questionText
=
questionText
;
return
this
;
}
public
CatalogueVariableBuilder
setSysId
(
String
sysId
)
{
this
.
sysId
=
sysId
;
return
this
;
}
public
CatalogueVariableBuilder
setNoneRequired
(
boolean
noneRequired
)
{
this
.
isNoneRequired
=
noneRequired
;
return
this
;
}
public
CatalogueVariableBuilder
setMandatory
(
boolean
mandatory
)
{
this
.
mandatory
=
mandatory
;
return
this
;
}
public
CatalogueVariableBuilder
setReferenceTable
(
String
referenceTable
)
{
this
.
referenceTable
=
referenceTable
;
return
this
;
}
public
CatalogueVariableBuilder
setOrder
(
int
order
)
{
this
.
order
=
order
;
return
this
;
}
public
CatalogueVariableBuilder
setReferenceColumnName
(
String
referenceColumnName
)
{
this
.
referenceColumnName
=
referenceColumnName
;
return
this
;
}
public
CatalogueVariableBuilder
setType
(
ViewType
type
)
{
this
.
type
=
type
;
return
this
;
}
public
CatalogueVariableBuilder
setSyncDirty
(
int
syncDirty
)
{
this
.
syncDirty
=
syncDirty
;
return
this
;
}
public
CatalogueVariableBuilder
but
()
{
return
aCatalogueVariable
().
setId
(
id
).
setCatalogueItemId
(
catalogue_item_id
).
setName
(
name
).
setQuestionText
(
questionText
).
setSysId
(
sysId
).
setNoneRequired
(
isNoneRequired
).
setMandatory
(
mandatory
).
setReferenceTable
(
referenceTable
).
setOrder
(
order
).
setReferenceColumnName
(
referenceColumnName
).
setType
(
type
).
setSyncDirty
(
syncDirty
);
}
public
CatalogueVariable
build
()
{
CatalogueVariable
catalogueVariable
=
new
CatalogueVariable
();
catalogueVariable
.
setId
(
id
);
catalogueVariable
.
setCatalogueItemId
(
catalogue_item_id
);
catalogueVariable
.
setName
(
name
);
catalogueVariable
.
setQuestionText
(
questionText
);
catalogueVariable
.
setSysId
(
sysId
);
catalogueVariable
.
setNoneRequired
(
isNoneRequired
);
catalogueVariable
.
setMandatory
(
mandatory
);
catalogueVariable
.
setReferenceTable
(
referenceTable
);
catalogueVariable
.
setOrder
(
order
);
catalogueVariable
.
setReferenceColumnName
(
referenceColumnName
);
catalogueVariable
.
setType
(
type
);
catalogueVariable
.
setSyncDirty
(
syncDirty
);
return
catalogueVariable
;
}
}
public
static
class
Json
{
public
static
class
Json
{
public
static
final
String
SYS_ID
=
"sys_id"
;
public
static
final
String
SYS_ID
=
"sys_id"
;
public
static
final
String
TYPE
=
"type"
;
public
static
final
String
TYPE
=
"type"
;
...
@@ -221,14 +352,18 @@ public class CatalogueVariable {
...
@@ -221,14 +352,18 @@ public class CatalogueVariable {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"CatalogueVariable{"
+
return
"CatalogueVariable{"
+
"name='"
+
name
+
'\''
+
"id="
+
id
+
", catalogue_item_id="
+
catalogue_item_id
+
", name='"
+
name
+
'\''
+
", questionText='"
+
questionText
+
'\''
+
", questionText='"
+
questionText
+
'\''
+
", sysId='"
+
sysId
+
'\''
+
", sysId='"
+
sysId
+
'\''
+
", mandatory="
+
mandatory
+
", mandatory="
+
mandatory
+
", isNoneRequired="
+
isNoneRequired
+
", isNoneRequired="
+
isNoneRequired
+
", referenceTable='"
+
referenceTable
+
'\''
+
", referenceTable='"
+
referenceTable
+
'\''
+
", order="
+
order
+
", order="
+
order
+
", referenceColumnName='"
+
referenceColumnName
+
'\''
+
", type="
+
type
+
", type="
+
type
+
", syncDirty="
+
syncDirty
+
", mVariableChoiceList="
+
mVariableChoiceList
+
", mVariableChoiceList="
+
mVariableChoiceList
+
'}'
;
'}'
;
}
}
...
...
app/src/main/java/com/vsoft/uoflservicenow/db/models/VariableChoice.java
View file @
b1352af9
...
@@ -6,6 +6,7 @@ import com.google.gson.annotations.SerializedName;
...
@@ -6,6 +6,7 @@ import com.google.gson.annotations.SerializedName;
public
class
VariableChoice
{
public
class
VariableChoice
{
private
long
id
;
private
long
variable_id
;
private
long
variable_id
;
@SerializedName
(
"text"
)
@SerializedName
(
"text"
)
...
@@ -21,6 +22,14 @@ public class VariableChoice {
...
@@ -21,6 +22,14 @@ public class VariableChoice {
@Expose
@Expose
private
float
misc
;
private
float
misc
;
public
long
getId
()
{
return
id
;
}
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
long
getVariableId
()
{
public
long
getVariableId
()
{
return
variable_id
;
return
variable_id
;
}
}
...
@@ -91,6 +100,67 @@ public class VariableChoice {
...
@@ -91,6 +100,67 @@ public class VariableChoice {
this
.
misc
=
misc
;
this
.
misc
=
misc
;
}
}
public
static
final
class
VariableChoiceBuilder
{
private
long
id
;
private
long
variable_id
;
private
String
text
;
private
String
value
;
private
int
order
;
private
float
misc
;
private
VariableChoiceBuilder
()
{
}
public
static
VariableChoiceBuilder
aVariableChoice
()
{
return
new
VariableChoiceBuilder
();
}
public
VariableChoiceBuilder
setId
(
long
id
)
{
this
.
id
=
id
;
return
this
;
}
public
VariableChoiceBuilder
setVariableId
(
long
variable_id
)
{
this
.
variable_id
=
variable_id
;
return
this
;
}
public
VariableChoiceBuilder
setText
(
String
text
)
{
this
.
text
=
text
;
return
this
;
}
public
VariableChoiceBuilder
setValue
(
String
value
)
{
this
.
value
=
value
;
return
this
;
}
public
VariableChoiceBuilder
setOrder
(
int
order
)
{
this
.
order
=
order
;
return
this
;
}
public
VariableChoiceBuilder
setMisc
(
float
misc
)
{
this
.
misc
=
misc
;
return
this
;
}
public
VariableChoiceBuilder
but
()
{
return
aVariableChoice
().
setId
(
id
).
setVariableId
(
variable_id
).
setText
(
text
).
setValue
(
value
).
setOrder
(
order
).
setMisc
(
misc
);
}
public
VariableChoice
build
()
{
VariableChoice
variableChoice
=
new
VariableChoice
();
variableChoice
.
setId
(
id
);
variableChoice
.
setVariableId
(
variable_id
);
variableChoice
.
setText
(
text
);
variableChoice
.
setValue
(
value
);
variableChoice
.
setOrder
(
order
);
variableChoice
.
setMisc
(
misc
);
return
variableChoice
;
}
}
public
static
class
Json
{
public
static
class
Json
{
public
static
final
String
URL_PARAM_VARIABLE_CHOICE_SYSPRM_QUERY_VALUE
=
"question"
;
public
static
final
String
URL_PARAM_VARIABLE_CHOICE_SYSPRM_QUERY_VALUE
=
"question"
;
}
}
...
@@ -98,6 +168,7 @@ public class VariableChoice {
...
@@ -98,6 +168,7 @@ public class VariableChoice {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"VariableChoice{"
+
return
"VariableChoice{"
+
"id="
+
id
+
", variable_id="
+
variable_id
+
", variable_id="
+
variable_id
+
", text='"
+
text
+
'\''
+
", text='"
+
text
+
'\''
+
", value='"
+
value
+
'\''
+
", value='"
+
value
+
'\''
+
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueItemScreen.java
View file @
b1352af9
...
@@ -148,9 +148,6 @@ public class CatalogueItemScreen extends AppCompatActivity {
...
@@ -148,9 +148,6 @@ public class CatalogueItemScreen extends AppCompatActivity {
CatalogueLog
.
e
(
"OnItemClickListener: position: "
+
position
+
", Catalogue: "
+
catalogueItemList
.
get
(
position
));
CatalogueLog
.
e
(
"OnItemClickListener: position: "
+
position
+
", Catalogue: "
+
catalogueItemList
.
get
(
position
));
Intent
intent
=
new
Intent
(
CatalogueItemScreen
.
this
,
CatalogueVariableScreen
.
class
);
Intent
intent
=
new
Intent
(
CatalogueItemScreen
.
this
,
CatalogueVariableScreen
.
class
);
intent
.
putExtra
(
Constants
.
DATA_KEY_SYS_ID
,
catalogueItemList
.
get
(
position
).
getSysId
());
intent
.
putExtra
(
Constants
.
DATA_KEY_SYS_ID
,
catalogueItemList
.
get
(
position
).
getSysId
());
intent
.
putExtra
(
Constants
.
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
,
catalogueItemList
.
get
(
position
).
getDescription
());
intent
.
putExtra
(
Constants
.
DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION
,
catalogueItemList
.
get
(
position
).
getShortDescription
());
intent
.
putExtra
(
Constants
.
DATA_KEY_CATALOGUE_TITLE
,
catalogueItemList
.
get
(
position
).
getName
());
startActivity
(
intent
);
startActivity
(
intent
);
}
}
});
});
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueScreen.java
View file @
b1352af9
...
@@ -127,7 +127,6 @@ public class CatalogueScreen extends AppCompatActivity {
...
@@ -127,7 +127,6 @@ public class CatalogueScreen extends AppCompatActivity {
CatalogueLog
.
e
(
"OnItemClickListener: position: "
+
position
+
", Catalogue: "
+
catalogueList
.
get
(
position
));
CatalogueLog
.
e
(
"OnItemClickListener: position: "
+
position
+
", Catalogue: "
+
catalogueList
.
get
(
position
));
Intent
intent
=
new
Intent
(
CatalogueScreen
.
this
,
CatalogueItemScreen
.
class
);
Intent
intent
=
new
Intent
(
CatalogueScreen
.
this
,
CatalogueItemScreen
.
class
);
intent
.
putExtra
(
Constants
.
DATA_KEY_SYS_ID
,
catalogueList
.
get
(
position
).
getSysId
());
intent
.
putExtra
(
Constants
.
DATA_KEY_SYS_ID
,
catalogueList
.
get
(
position
).
getSysId
());
intent
.
putExtra
(
Constants
.
DATA_KEY_CATALOGUE_TITLE
,
catalogueList
.
get
(
position
).
getTitle
());
startActivity
(
intent
);
startActivity
(
intent
);
}
}
});
});
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
View file @
b1352af9
...
@@ -34,8 +34,11 @@ import com.vsoft.uoflservicenow.api.listeners.get.GetCatalogueVariableApiListene
...
@@ -34,8 +34,11 @@ import com.vsoft.uoflservicenow.api.listeners.get.GetCatalogueVariableApiListene
import
com.vsoft.uoflservicenow.api.listeners.get.GetVariableChoiceApiListener
;
import
com.vsoft.uoflservicenow.api.listeners.get.GetVariableChoiceApiListener
;
import
com.vsoft.uoflservicenow.api.managers.CatalogueVariableApiManager
;
import
com.vsoft.uoflservicenow.api.managers.CatalogueVariableApiManager
;
import
com.vsoft.uoflservicenow.api.managers.VariableChoiceApiManager
;
import
com.vsoft.uoflservicenow.api.managers.VariableChoiceApiManager
;
import
com.vsoft.uoflservicenow.api.managers.VariableChoiceManager
;
import
com.vsoft.uoflservicenow.db.managers.CatalogueItemManager
;
import
com.vsoft.uoflservicenow.db.managers.CatalogueVariableManager
;
import
com.vsoft.uoflservicenow.db.models.CatalogueItem
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariable
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariable
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariableSet
;
import
com.vsoft.uoflservicenow.db.models.Reference
;
import
com.vsoft.uoflservicenow.db.models.Reference
;
import
com.vsoft.uoflservicenow.db.models.VariableChoice
;
import
com.vsoft.uoflservicenow.db.models.VariableChoice
;
import
com.vsoft.uoflservicenow.dialog.SelectReferenceDialog
;
import
com.vsoft.uoflservicenow.dialog.SelectReferenceDialog
;
...
@@ -71,10 +74,10 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -71,10 +74,10 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@BindView
(
R
.
id
.
variable_screen_container_layout
)
LinearLayout
mContainerLayout
;
@BindView
(
R
.
id
.
variable_screen_container_layout
)
LinearLayout
mContainerLayout
;
@BindView
(
R
.
id
.
variable_screen_bottom_layout
)
RelativeLayout
mBottomLayout
;
@BindView
(
R
.
id
.
variable_screen_bottom_layout
)
RelativeLayout
mBottomLayout
;
private
List
<
CatalogueVariable
>
mCatalogueVariableList
=
new
ArrayList
<>();
private
CatalogueItem
mCatalogueItem
;
private
List
<
CatalogueVariable
>
mCatalogueVariableList
;
private
JSONArray
mJsonArray
;
private
JSONArray
mJsonArray
;
private
CatalogueApplication
mApplication
;
private
CatalogueApplication
mApplication
;
private
String
mCatalogueItemSysId
,
mCatalogueItemDescription
,
mCatalogueItemShortDescription
,
mCatalogueItemTitle
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -88,34 +91,44 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -88,34 +91,44 @@ public class CatalogueVariableScreen extends AppCompatActivity {
mApplication
=
(
CatalogueApplication
)
getApplication
();
mApplication
=
(
CatalogueApplication
)
getApplication
();
Bundle
extras
=
getIntent
().
getExtras
();
Bundle
extras
=
getIntent
().
getExtras
();
mC
atalogueItemSysId
=
null
;
String
c
atalogueItemSysId
=
null
;
if
(
extras
!=
null
)
{
if
(
extras
!=
null
)
{
mCatalogueItemSysId
=
extras
.
getString
(
Constants
.
DATA_KEY_SYS_ID
);
catalogueItemSysId
=
extras
.
getString
(
Constants
.
DATA_KEY_SYS_ID
);
mCatalogueItemDescription
=
extras
.
getString
(
Constants
.
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
);
mCatalogueItemShortDescription
=
extras
.
getString
(
Constants
.
DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION
);
mCatalogueItemTitle
=
extras
.
getString
(
Constants
.
DATA_KEY_CATALOGUE_TITLE
);
//The key argument here must match that used in the other activity
//The key argument here must match that used in the other activity
}
}
mCatalogueItem
=
CatalogueItemManager
.
getCatalogueItemFromSysId
(
catalogueItemSysId
);
if
(
mCatalogueItem
==
null
)
{
CatalogueLog
.
e
(
"CatalogueVariableScreen: onCreate: mCatalogueItem is null"
);
return
;
}
setSupportActionBar
(
mToolbar
);
setSupportActionBar
(
mToolbar
);
ActionBar
actionBar
=
getSupportActionBar
();
ActionBar
actionBar
=
getSupportActionBar
();
if
(
actionBar
!=
null
)
{
if
(
actionBar
!=
null
)
{
actionBar
.
setDisplayHomeAsUpEnabled
(
true
);
actionBar
.
setDisplayHomeAsUpEnabled
(
true
);
actionBar
.
setElevation
(
0
);
actionBar
.
setElevation
(
0
);
actionBar
.
setTitle
(
mCatalogueItem
Title
);
actionBar
.
setTitle
(
mCatalogueItem
.
getName
()
);
actionBar
.
setDisplayShowHomeEnabled
(
false
);
actionBar
.
setDisplayShowHomeEnabled
(
false
);
actionBar
.
setDisplayShowTitleEnabled
(
true
);
actionBar
.
setDisplayShowTitleEnabled
(
true
);
}
}
Tracker
tracker
=
mApplication
.
getDefaultTracker
();
mCatalogueVariableList
=
CatalogueVariableManager
.
getAllVariable
(
mCatalogueItem
.
getId
());
// Send initial screen view hit.
setVariableChoices
();
Util
.
sendScreenName
(
tracker
,
actionBar
.
getTitle
().
toString
());
if
(
mApplication
.
isNetConnected
())
{
if
(
mCatalogueVariableList
.
isEmpty
())
{
new
FetchCatalogueVariable
().
execute
();
if
(
mApplication
.
isNetConnected
())
{
new
FetchCatalogueVariable
().
execute
();
}
else
{
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
CatalogueVariableScreen
.
this
);
}
}
else
{
}
else
{
DialogUtils
.
showNoConnectionDialogWithCloseActivity
(
CatalogueVariableScreen
.
this
);
createView
(
);
}
}
Tracker
tracker
=
mApplication
.
getDefaultTracker
();
// Send initial screen view hit.
Util
.
sendScreenName
(
tracker
,
actionBar
.
getTitle
().
toString
());
}
}
class
FetchCatalogueVariable
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
class
FetchCatalogueVariable
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
...
@@ -133,19 +146,29 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -133,19 +146,29 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override
@Override
protected
SyncStatus
doInBackground
(
String
...
params
)
{
protected
SyncStatus
doInBackground
(
String
...
params
)
{
syncStatus
=
CatalogueVariableApiManager
.
getCatalogueVariable
(
mCatalogueItem
SysId
,
new
GetCatalogueVariableApiListener
()
{
syncStatus
=
CatalogueVariableApiManager
.
getCatalogueVariable
(
mCatalogueItem
.
getSysId
()
,
new
GetCatalogueVariableApiListener
()
{
@Override
@Override
public
void
onDoneApiCall
(
List
<
CatalogueVariableSet
>
variableSetList
,
List
<
CatalogueVariable
>
variableList
)
{
public
void
onDoneApiCall
(
List
<
CatalogueVariable
>
catalogueVariableList
)
{
CatalogueVariableManager
.
handleGetVariable
(
mCatalogueItem
.
getId
(),
catalogueVariableList
);
/*For variableset */
if
(!
catalogueVariableList
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
variableSetList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
catalogueVariableList
.
size
();
i
++)
{
CatalogueVariableSet
catalogueVariableSet
=
variableSetList
.
get
(
i
);
final
CatalogueVariable
catalogueVariable
=
catalogueVariableList
.
get
(
i
);
setVariableChoiceData
(
catalogueVariableSet
.
getVariables
());
if
(
catalogueVariable
.
getType
()
==
ViewType
.
MULTIPLE_CHOICE
||
catalogueVariable
.
getType
()
==
ViewType
.
SELECT_BOX
)
{
/*Fetch multi choice variable values*/
VariableChoiceApiManager
.
getVariableChoice
(
catalogueVariable
.
getSysId
(),
new
GetVariableChoiceApiListener
()
{
@Override
public
void
onDoneApiCall
(
List
<
VariableChoice
>
variableChoiceList
)
{
CatalogueLog
.
e
(
"Data: variableChoiceList: "
+
variableChoiceList
);
catalogueVariable
.
setVariableChoiceList
(
variableChoiceList
);
VariableChoiceManager
.
handleGetVariableChoice
(
catalogueVariable
.
getId
(),
variableChoiceList
);
}
});
}
}
/*Create Dynamic table for CatalogueVariable*/
Util
.
createDynamicTable
(
mCatalogueItem
.
getSysId
(),
catalogueVariableList
);
}
}
/*For variable list*/
setVariableChoiceData
(
variableList
);
}
}
});
});
return
syncStatus
;
return
syncStatus
;
...
@@ -158,32 +181,25 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -158,32 +181,25 @@ public class CatalogueVariableScreen extends AppCompatActivity {
progressDialog
.
dismiss
();
progressDialog
.
dismiss
();
}
}
if
(
syncStatus
==
SyncStatus
.
SUCCESS
)
{
if
(
syncStatus
==
SyncStatus
.
SUCCESS
)
{
if
(
mCatalogueVariableList
!=
null
)
{
mCatalogueVariableList
=
CatalogueVariableManager
.
getAllVariable
(
mCatalogueItem
.
getId
());
createView
();
setVariableChoices
();
}
createView
();
}
else
{
}
else
{
showErrorDialog
(
R
.
string
.
failed_to_fetch_catalogue_form_string
);
showErrorDialog
(
R
.
string
.
failed_to_fetch_catalogue_form_string
);
}
}
}
}
}
}
private
void
setVariableChoice
Data
(
List
<
CatalogueVariable
>
variableList
)
{
private
void
setVariableChoice
s
(
)
{
if
(!
v
ariableList
.
isEmpty
())
{
if
(!
mCatalogueV
ariableList
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
v
ariableList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
mCatalogueV
ariableList
.
size
();
i
++)
{
final
CatalogueVariable
catalogueVariable
=
v
ariableList
.
get
(
i
);
CatalogueVariable
catalogueVariable
=
mCatalogueV
ariableList
.
get
(
i
);
if
(
catalogueVariable
.
getType
()
==
ViewType
.
MULTIPLE_CHOICE
if
(
catalogueVariable
.
getType
()
==
ViewType
.
MULTIPLE_CHOICE
||
catalogueVariable
.
getType
()
==
ViewType
.
SELECT_BOX
)
{
||
catalogueVariable
.
getType
()
==
ViewType
.
SELECT_BOX
)
{
/*Fetch multi choice variable values*/
List
<
VariableChoice
>
variableChoiceList
=
VariableChoiceManager
.
getAllVariableChoices
(
catalogueVariable
.
getId
());
VariableChoiceApiManager
.
getVariableChoice
(
catalogueVariable
.
getSysId
(),
new
GetVariableChoiceApiListener
()
{
catalogueVariable
.
setVariableChoiceList
(
variableChoiceList
);
@Override
public
void
onDoneApiCall
(
List
<
VariableChoice
>
variableChoiceList
)
{
CatalogueLog
.
e
(
"Data: variableChoiceList: "
+
variableChoiceList
);
catalogueVariable
.
setVariableChoiceList
(
variableChoiceList
);
}
});
}
}
}
}
mCatalogueVariableList
.
addAll
(
variableList
);
}
}
}
}
...
@@ -205,23 +221,23 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -205,23 +221,23 @@ public class CatalogueVariableScreen extends AppCompatActivity {
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
);
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
);
/*Added item Description in form*/
/*Added item Description in form*/
if
(
mCatalogueItem
ShortDescription
!=
null
&&
!
mCatalogueItemShortDescription
.
isEmpty
())
{
if
(
mCatalogueItem
.
getShortDescription
()
!=
null
&&
!
mCatalogueItem
.
getShortDescription
()
.
isEmpty
())
{
TextView
shortDescriptionView
=
new
TextView
(
CatalogueVariableScreen
.
this
);
TextView
shortDescriptionView
=
new
TextView
(
CatalogueVariableScreen
.
this
);
shortDescriptionView
.
setPadding
(
0
,
0
,
0
,
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
normal_margin
));
shortDescriptionView
.
setPadding
(
0
,
0
,
0
,
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
normal_margin
));
shortDescriptionView
.
setTypeface
(
null
,
Typeface
.
BOLD
);
shortDescriptionView
.
setTypeface
(
null
,
Typeface
.
BOLD
);
shortDescriptionView
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
shortDescriptionView
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
N
)
{
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
N
)
{
shortDescriptionView
.
setText
(
Html
.
fromHtml
(
mCatalogueItem
ShortDescription
,
Html
.
FROM_HTML_MODE_LEGACY
));
shortDescriptionView
.
setText
(
Html
.
fromHtml
(
mCatalogueItem
.
getShortDescription
()
,
Html
.
FROM_HTML_MODE_LEGACY
));
}
else
{
}
else
{
shortDescriptionView
.
setText
(
Html
.
fromHtml
(
mCatalogueItem
ShortDescription
));
shortDescriptionView
.
setText
(
Html
.
fromHtml
(
mCatalogueItem
.
getShortDescription
()
));
}
}
mContainerLayout
.
addView
(
shortDescriptionView
,
childControlViewLayoutParams
);
mContainerLayout
.
addView
(
shortDescriptionView
,
childControlViewLayoutParams
);
}
}
if
(
mCatalogueItem
Description
!=
null
&&
!
mCatalogueItemDescription
.
isEmpty
())
{
if
(
mCatalogueItem
.
getDescription
()
!=
null
&&
!
mCatalogueItem
.
getDescription
()
.
isEmpty
())
{
WebView
descriptionView
=
new
WebView
(
CatalogueVariableScreen
.
this
);
WebView
descriptionView
=
new
WebView
(
CatalogueVariableScreen
.
this
);
descriptionView
.
loadData
(
mCatalogueItem
Description
,
"text/html; charset=utf-8"
,
"utf-8"
);
descriptionView
.
loadData
(
mCatalogueItem
.
getDescription
()
,
"text/html; charset=utf-8"
,
"utf-8"
);
mContainerLayout
.
addView
(
descriptionView
,
childControlViewLayoutParams
);
mContainerLayout
.
addView
(
descriptionView
,
childControlViewLayoutParams
);
}
}
...
@@ -486,7 +502,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -486,7 +502,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override
@Override
protected
SyncStatus
doInBackground
(
String
...
params
)
{
protected
SyncStatus
doInBackground
(
String
...
params
)
{
return
CatalogueVariableApiManager
.
submitVariableForm
(
mCatalogueItem
SysId
,
mJsonArray
);
return
CatalogueVariableApiManager
.
submitVariableForm
(
mCatalogueItem
.
getSysId
()
,
mJsonArray
);
}
}
@Override
@Override
...
...
app/src/main/java/com/vsoft/uoflservicenow/utils/Constants.java
View file @
b1352af9
...
@@ -26,9 +26,6 @@ public class Constants {
...
@@ -26,9 +26,6 @@ public class Constants {
*/
*/
public
static
final
String
DATA_DATE_AND_TIME_PICKER_TITLE
=
"title"
;
public
static
final
String
DATA_DATE_AND_TIME_PICKER_TITLE
=
"title"
;
public
static
final
String
DATA_KEY_SYS_ID
=
"sys_id"
;
public
static
final
String
DATA_KEY_SYS_ID
=
"sys_id"
;
public
static
final
String
DATA_KEY_CATALOGUE_TITLE
=
"catalogue_title"
;
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
=
"catalogue_item_des"
;
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION
=
"catalogue_item_short_des"
;
public
static
final
String
DATA_KEY_REFERENCE_TABLE_NAME
=
"table_name"
;
public
static
final
String
DATA_KEY_REFERENCE_TABLE_NAME
=
"table_name"
;
public
static
final
String
DATA_KEY_REFERENCE_TABLE_COLUMN_NAME
=
"table_column_name"
;
public
static
final
String
DATA_KEY_REFERENCE_TABLE_COLUMN_NAME
=
"table_column_name"
;
public
static
final
String
DATA_KEY_REFERENCE_TITLE
=
"title"
;
public
static
final
String
DATA_KEY_REFERENCE_TITLE
=
"title"
;
...
...
app/src/main/java/com/vsoft/uoflservicenow/utils/DBConstants.java
View file @
b1352af9
...
@@ -4,6 +4,8 @@ public interface DBConstants {
...
@@ -4,6 +4,8 @@ public interface DBConstants {
//Tables
//Tables
String
TABLE_CATALOGUE
=
"catalogue_category"
;
String
TABLE_CATALOGUE
=
"catalogue_category"
;
String
TABLE_CATALOGUE_ITEM
=
"catalogue_category_item"
;
String
TABLE_CATALOGUE_ITEM
=
"catalogue_category_item"
;
String
TABLE_CATALOGUE_VARIABLES
=
"catalogue_variable"
;
String
TABLE_VARIABLE_CHOICES
=
"variable_choices"
;
String
ID
=
"_id"
;
String
ID
=
"_id"
;
String
SYS_ID
=
"sys_id"
;
String
SYS_ID
=
"sys_id"
;
...
@@ -62,4 +64,59 @@ public interface DBConstants {
...
@@ -62,4 +64,59 @@ public interface DBConstants {
int
CATALOGUE_ITEM_COLUMN_COUNT
=
8
;
int
CATALOGUE_ITEM_COLUMN_COUNT
=
8
;
/**
* Catalogue variables table
*/
String
CATALOGUE_VARIABLE_ID
=
ID
;
String
CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
=
"catalogue_item_id"
;
String
CATALOGUE_VARIABLE_SYS_ID
=
SYS_ID
;
String
CATALOGUE_VARIABLE_NAME
=
"name"
;
String
CATALOGUE_VARIABLE_QUESTION_TEXT
=
"question_text"
;
String
CATALOGUE_VARIABLE_TYPE
=
"type"
;
String
CATALOGUE_VARIABLE_MANDATORY
=
"mandatory"
;
String
CATALOGUE_VARIABLE_NONE_REQUIRED
=
"none_required"
;
String
CATALOGUE_VARIABLE_REFERENCE_TABLE
=
"reference_table"
;
String
CATALOGUE_VARIABLE_ORDER
=
"variable_order"
;
String
CATALOGUE_VARIABLE_REFERENCE_COLUMN_NAME
=
"reference_column_name"
;
String
CATALOGUE_VARIABLE_SYNC_DIRTY
=
SYNC_DIRTY
;
/**
* Indices for Catalogue variables table. *Use these only if you fetch all columns*
*/
int
INDEX_CATALOGUE_VARIABLE_ID
=
0
;
int
INDEX_CATALOGUE_VARIABLE_CATALOGUE_ITEM_ID
=
1
;
int
INDEX_CATALOGUE_VARIABLE_SYS_ID
=
2
;
int
INDEX_CATALOGUE_VARIABLE_NAME
=
3
;
int
INDEX_CATALOGUE_VARIABLE_QUESTION_TEXT
=
4
;
int
INDEX_CATALOGUE_VARIABLE_TYPE
=
5
;
int
INDEX_CATALOGUE_VARIABLE_MANDATORY
=
6
;
int
INDEX_CATALOGUE_VARIABLE_NONE_REQUIRED
=
7
;
int
INDEX_CATALOGUE_VARIABLE_REFERENCE
=
8
;
int
INDEX_CATALOGUE_VARIABLE_ORDER
=
9
;
int
INDEX_CATALOGUE_VARIABLE_REFERENCE_COLUMN_NAME
=
10
;
int
INDEX_CATALOGUE_VARIABLE_SYNC_DIRTY
=
11
;
int
CATALOGUE_VARIABLE_COLUMN_COUNT
=
12
;
/**
* Variables Choice table
*/
String
VARIABLE_CHOICE_ID
=
ID
;
String
VARIABLE_CHOICE_VARIABLE_ID
=
"variable_id"
;
String
VARIABLE_CHOICE_TEXT
=
"text"
;
String
VARIABLE_CHOICE_VALUE
=
"value"
;
String
VARIABLE_CHOICE_ORDER
=
"choice_order"
;
String
VARIABLE_CHOICE_MISC
=
"misc"
;
/**
* Indices for Variables Choice table. *Use these only if you fetch all columns*
*/
int
INDEX_VARIABLE_CHOICE_ID
=
0
;
int
INDEX_VARIABLE_CHOICE_VARIABLE_ID
=
1
;
int
INDEX_VARIABLE_CHOICE_TEXT
=
2
;
int
INDEX_VARIABLE_CHOICE_VALUE
=
3
;
int
INDEX_VARIABLE_CHOICE_ORDER
=
4
;
int
INDEX_VARIABLE_CHOICE_MISC
=
5
;
int
VARIABLE_CHOICE_COLUMN_COUNT
=
6
;
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uoflservicenow/utils/Util.java
View file @
b1352af9
package
com
.
vsoft
.
uoflservicenow
.
utils
;
package
com
.
vsoft
.
uoflservicenow
.
utils
;
import
android.content.Context
;
import
android.content.Context
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.graphics.Typeface
;
import
android.graphics.Typeface
;
import
android.support.v4.content.ContextCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.text.InputType
;
import
android.text.InputType
;
...
@@ -21,6 +22,7 @@ import android.widget.TextView;
...
@@ -21,6 +22,7 @@ import android.widget.TextView;
import
com.google.android.gms.analytics.HitBuilders
;
import
com.google.android.gms.analytics.HitBuilders
;
import
com.google.android.gms.analytics.Tracker
;
import
com.google.android.gms.analytics.Tracker
;
import
com.vsoft.uoflservicenow.CatalogueApplication
;
import
com.vsoft.uoflservicenow.R
;
import
com.vsoft.uoflservicenow.R
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariable
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariable
;
import
com.vsoft.uoflservicenow.db.models.Reference
;
import
com.vsoft.uoflservicenow.db.models.Reference
;
...
@@ -31,6 +33,7 @@ import java.text.ParseException;
...
@@ -31,6 +33,7 @@ import java.text.ParseException;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
/**
/**
...
@@ -311,6 +314,41 @@ public class Util {
...
@@ -311,6 +314,41 @@ public class Util {
return
date
.
getTime
();
return
date
.
getTime
();
}
}
public
static
void
createDynamicTable
(
String
catalogueItemSysId
,
List
<
CatalogueVariable
>
catalogueVariableList
)
{
StringBuilder
queryString
=
new
StringBuilder
();
//Opens database in writable mode.
SQLiteDatabase
database
=
CatalogueApplication
.
getDatabase
();
queryString
.
append
(
"CREATE TABLE IF NOT EXISTS t_"
);
queryString
.
append
(
catalogueItemSysId
);
queryString
.
append
(
" ("
);
queryString
.
append
(
DBConstants
.
ID
);
queryString
.
append
(
" integer primary key autoincrement, "
);
CatalogueVariable
catalogueVariable
=
catalogueVariableList
.
get
(
0
);
if
(
catalogueVariable
.
getName
()
!=
null
)
{
queryString
.
append
(
catalogueVariable
.
getName
());
queryString
.
append
(
" text, "
);
}
for
(
int
i
=
1
;
i
<
catalogueVariableList
.
size
();
i
++)
{
catalogueVariable
=
catalogueVariableList
.
get
(
i
);
if
(
catalogueVariable
.
getName
()!=
null
)
{
queryString
.
append
(
catalogueVariable
.
getName
());
queryString
.
append
(
" text, "
);
}
}
queryString
.
append
(
DBConstants
.
CATALOGUE_VARIABLE_SYNC_DIRTY
);
queryString
.
append
(
" integer default "
);
queryString
.
append
(
DBConstants
.
SYNC_FLAG_NONE
);
queryString
.
append
(
");"
);
System
.
out
.
println
(
"Create Table Stmt : "
+
queryString
);
database
.
execSQL
(
queryString
.
toString
());
}
/*Record a screen view hit for the visible*/
/*Record a screen view hit for the visible*/
public
static
void
sendScreenName
(
Tracker
tracker
,
String
name
)
{
public
static
void
sendScreenName
(
Tracker
tracker
,
String
name
)
{
tracker
.
setScreenName
(
name
);
tracker
.
setScreenName
(
name
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment