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
628c9287
authored
Sep 09, 2016
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
UOFLMA-78 : Fix - Reference search API changes.
parent
e7724bc7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
8 deletions
app/src/main/java/com/vsoft/uoflservicenow/api/interfaces/CatalogueVariableApi.java
app/src/main/java/com/vsoft/uoflservicenow/api/managers/VariableChoiceApiManager.java
app/src/main/java/com/vsoft/uoflservicenow/db/models/CatalogueVariable.java
app/src/main/java/com/vsoft/uoflservicenow/dialog/SelectReferenceDialog.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/api/interfaces/CatalogueVariableApi.java
View file @
628c9287
...
...
@@ -2,15 +2,17 @@ package com.vsoft.uoflservicenow.api.interfaces;
import
com.vsoft.uoflservicenow.db.models.CatalogueItem
;
import
com.vsoft.uoflservicenow.db.models.CatalogueVariable
;
import
com.vsoft.uoflservicenow.db.models.Reference
;
import
com.vsoft.uoflservicenow.utils.Constants
;
import
java.util.Map
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
import
retrofit2.http.POST
;
import
retrofit2.http.Query
;
import
retrofit2.http.QueryMap
;
import
retrofit2.http.Url
;
...
...
@@ -36,7 +38,7 @@ public interface CatalogueVariableApi {
// Get Reference API
@GET
Call
<
ResponseBody
>
getReference
(
@Url
String
url
,
@Query
(
Reference
.
Json
.
FIRST_NAME
)
String
firstName
);
Call
<
ResponseBody
>
getReference
(
@Url
String
url
,
@Query
Map
Map
<
String
,
String
>
options
);
}
app/src/main/java/com/vsoft/uoflservicenow/api/managers/VariableChoiceApiManager.java
View file @
628c9287
...
...
@@ -24,6 +24,7 @@ import java.io.IOException;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
...
...
@@ -128,11 +129,11 @@ public class VariableChoiceApiManager {
}
}
public
static
SyncStatus
getReference
(
String
tableName
,
String
firstName
,
GetReferenceApiListener
listener
)
{
public
static
SyncStatus
getReference
(
String
tableName
,
Map
<
String
,
String
>
queryMap
,
GetReferenceApiListener
listener
)
{
CatalogueLog
.
d
(
"VariableChoiceApiManager: getReference: tableName: "
+
tableName
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueVariableApi
.
class
).
getReference
(
Constants
.
URL_GET_REFERENCE
+
tableName
,
firstName
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueVariableApi
.
class
).
getReference
(
Constants
.
URL_GET_REFERENCE
+
tableName
,
queryMap
);
try
{
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
...
...
app/src/main/java/com/vsoft/uoflservicenow/db/models/CatalogueVariable.java
View file @
628c9287
...
...
@@ -39,6 +39,9 @@ public class CatalogueVariable {
@SerializedName
(
"order"
)
@Expose
private
int
order
;
@SerializedName
(
"reference_display_column"
)
@Expose
private
String
referenceColumnName
;
// @SerializedName("type")
// @Expose
...
...
@@ -150,6 +153,14 @@ public class CatalogueVariable {
this
.
order
=
order
;
}
public
String
getReferenceColumnName
()
{
return
referenceColumnName
;
}
public
void
setReferenceColumnName
(
String
referenceColumnName
)
{
this
.
referenceColumnName
=
referenceColumnName
;
}
public
List
<
VariableChoice
>
getVariableChoiceList
()
{
return
mVariableChoiceList
;
}
...
...
app/src/main/java/com/vsoft/uoflservicenow/dialog/SelectReferenceDialog.java
View file @
628c9287
...
...
@@ -32,7 +32,9 @@ import com.vsoft.uoflservicenow.utils.DialogUtils;
import
com.vsoft.uoflservicenow.utils.Util
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
...
...
@@ -54,7 +56,7 @@ public class SelectReferenceDialog extends DialogFragment {
private
ReferenceListener
mListener
;
private
Unbinder
mUnbinder
;
private
List
<
Reference
>
mReferenceList
;
private
String
mReferenceTableName
,
mReferenceTitle
;
private
String
mReferenceTableName
,
mReference
ColumnName
,
mReference
Title
;
private
CatalogueApplication
mApplication
;
public
SelectReferenceDialog
()
{
...
...
@@ -65,11 +67,12 @@ public class SelectReferenceDialog extends DialogFragment {
mListener
=
listener
;
}
public
static
SelectReferenceDialog
newInstance
(
String
tableName
,
String
title
)
{
public
static
SelectReferenceDialog
newInstance
(
String
tableName
,
String
columnName
,
String
title
)
{
SelectReferenceDialog
selectReferenceDialog
=
new
SelectReferenceDialog
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
Constants
.
DATA_KEY_REFERENCE_TABLE_NAME
,
tableName
);
bundle
.
putString
(
Constants
.
DATA_KEY_REFERENCE_TABLE_COLUMN_NAME
,
columnName
);
bundle
.
putString
(
Constants
.
DATA_KEY_REFERENCE_TITLE
,
title
);
selectReferenceDialog
.
setArguments
(
bundle
);
...
...
@@ -83,6 +86,7 @@ public class SelectReferenceDialog extends DialogFragment {
mApplication
=
(
CatalogueApplication
)
getActivity
().
getApplication
();
mReferenceTableName
=
getArguments
().
getString
(
Constants
.
DATA_KEY_REFERENCE_TABLE_NAME
);
mReferenceColumnName
=
getArguments
().
getString
(
Constants
.
DATA_KEY_REFERENCE_TABLE_COLUMN_NAME
);
mReferenceTitle
=
getArguments
().
getString
(
Constants
.
DATA_KEY_REFERENCE_TITLE
);
}
...
...
@@ -168,7 +172,9 @@ public class SelectReferenceDialog extends DialogFragment {
@Override
protected
SyncStatus
doInBackground
(
String
...
params
)
{
return
VariableChoiceApiManager
.
getReference
(
mReferenceTableName
,
params
[
0
],
new
GetReferenceApiListener
()
{
Map
<
String
,
String
>
stringMap
=
new
HashMap
<>(
1
);
stringMap
.
put
(
mReferenceColumnName
,
params
[
0
]);
return
VariableChoiceApiManager
.
getReference
(
mReferenceTableName
,
stringMap
,
new
GetReferenceApiListener
()
{
@Override
public
void
onDoneApiCall
(
List
<
Reference
>
referenceList
)
{
mReferenceList
=
referenceList
;
...
...
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
View file @
628c9287
...
...
@@ -460,8 +460,9 @@ public class CatalogueVariableScreen extends AppCompatActivity {
TagObject
tagObject
=
(
TagObject
)
v
.
getTag
();
CatalogueVariable
catalogueVariable
=
mCatalogueVariableList
.
get
(
tagObject
.
getIndex
());
String
tableName
=
catalogueVariable
.
getReferenceTable
();
String
columnName
=
catalogueVariable
.
getReferenceColumnName
();
String
title
=
catalogueVariable
.
getQuestionText
();
SelectReferenceDialog
spinnerDialog
=
SelectReferenceDialog
.
newInstance
(
tableName
,
title
);
SelectReferenceDialog
spinnerDialog
=
SelectReferenceDialog
.
newInstance
(
tableName
,
columnName
,
title
);
spinnerDialog
.
setListener
(
listener
);
spinnerDialog
.
show
(
fm
,
""
);
return
true
;
...
...
app/src/main/java/com/vsoft/uoflservicenow/utils/Constants.java
View file @
628c9287
...
...
@@ -27,6 +27,7 @@ public class Constants {
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_COLUMN_NAME
=
"table_column_name"
;
public
static
final
String
DATA_KEY_REFERENCE_TITLE
=
"title"
;
/**
...
...
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