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
54d3d903
authored
Sep 06, 2016
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
UOFLMA-68: Added one more field "Order" in Variable Form, for sorting all items.
parent
8d8bd9c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
14 deletions
app/src/main/java/com/vsoft/uoflservicenow/api/managers/CatalogueVariableApiManager.java
app/src/main/java/com/vsoft/uoflservicenow/db/models/CatalogueVariable.java
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
app/src/main/java/com/vsoft/uoflservicenow/api/managers/CatalogueVariableApiManager.java
View file @
54d3d903
...
...
@@ -93,8 +93,7 @@ public class CatalogueVariableApiManager {
JSONObject
variableJsonObject
=
catalogueVariableJsonArray
.
getJSONObject
(
i
);
CatalogueVariable
catalogueVariable
=
gson
.
fromJson
(
variableJsonObject
.
toString
(),
CatalogueVariable
.
class
);
catalogueVariable
.
parseJson
(
variableJsonObject
);
// if(catalogueVariable.getName()!=null)
catalogueVariableList
.
add
(
catalogueVariable
);
catalogueVariableList
.
add
(
catalogueVariable
);
}
listener
.
onDoneApiCall
(
catalogueVariableList
);
}
else
{
...
...
app/src/main/java/com/vsoft/uoflservicenow/db/models/CatalogueVariable.java
View file @
54d3d903
...
...
@@ -17,7 +17,6 @@ import java.util.List;
* Created by Kunj on 12/8/16.
*/
public
class
CatalogueVariable
{
private
long
catalogue_item_id
=
-
1
;
@SerializedName
(
"name"
)
@Expose
...
...
@@ -37,6 +36,9 @@ public class CatalogueVariable {
@SerializedName
(
"reference_table"
)
@Expose
private
String
referenceTable
;
@SerializedName
(
"order"
)
@Expose
private
int
order
;
// @SerializedName("type")
// @Expose
...
...
@@ -44,14 +46,6 @@ public class CatalogueVariable {
private
List
<
VariableChoice
>
mVariableChoiceList
;
public
long
getCatalogueItemId
()
{
return
catalogue_item_id
;
}
public
void
setCatalogueItemId
(
long
catalogue_item_id
)
{
this
.
catalogue_item_id
=
catalogue_item_id
;
}
/**
*
* @return
...
...
@@ -148,6 +142,14 @@ public class CatalogueVariable {
this
.
referenceTable
=
referenceTable
;
}
public
int
getOrder
()
{
return
order
;
}
public
void
setOrder
(
int
order
)
{
this
.
order
=
order
;
}
public
List
<
VariableChoice
>
getVariableChoiceList
()
{
return
mVariableChoiceList
;
}
...
...
@@ -202,18 +204,19 @@ public class CatalogueVariable {
public
static
class
Json
{
public
static
final
String
SYS_ID
=
"sys_id"
;
public
static
final
String
TYPE
=
"type"
;
public
static
final
String
ORDER
=
"order"
;
}
@Override
public
String
toString
()
{
return
"CatalogueVariable{"
+
", catalogue_item_id="
+
catalogue_item_id
+
", name='"
+
name
+
'\''
+
"name='"
+
name
+
'\''
+
", questionText='"
+
questionText
+
'\''
+
", sysId='"
+
sysId
+
'\''
+
", mandatory="
+
mandatory
+
", isNoneRequired="
+
isNoneRequired
+
", referenceTable='"
+
referenceTable
+
'\''
+
", order="
+
order
+
", type="
+
type
+
", mVariableChoiceList="
+
mVariableChoiceList
+
'}'
;
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
View file @
54d3d903
...
...
@@ -49,6 +49,8 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
butterknife.BindView
;
...
...
@@ -133,6 +135,14 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override
public
void
onDoneApiCall
(
List
<
CatalogueVariable
>
catalogueVariableList
)
{
CatalogueLog
.
e
(
"Data: catalogueVariableList: "
+
catalogueVariableList
);
Collections
.
sort
(
catalogueVariableList
,
new
Comparator
<
CatalogueVariable
>()
{
@Override
public
int
compare
(
CatalogueVariable
lhs
,
CatalogueVariable
rhs
)
{
return
(
lhs
.
getOrder
()
-
rhs
.
getOrder
());
}
});
mCatalogueVariableList
=
catalogueVariableList
;
if
(!
catalogueVariableList
.
isEmpty
())
{
...
...
@@ -211,7 +221,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
for
(
int
i
=
0
;
i
<
mCatalogueVariableList
.
size
();
i
++)
{
CatalogueVariable
catalogueVariable
=
mCatalogueVariableList
.
get
(
i
);
ViewType
viewType
=
catalogueVariable
.
getType
();
CatalogueLog
.
e
(
"viewType: "
+
viewType
);
CatalogueLog
.
e
(
"viewType: "
+
viewType
+
", Order: "
+
catalogueVariable
.
getOrder
()
);
if
(
catalogueVariable
.
getName
()
==
null
)
{
TextView
nameNullView
=
new
TextView
(
CatalogueVariableScreen
.
this
);
nameNullView
.
setText
(
R
.
string
.
name_null_view_string
);
...
...
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