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
ed08d6e6
authored
Aug 31, 2016
by
Krishna Vemulavada
Browse files
Options
_('Browse Files')
Download
Plain Diff
userapi integraion
parents
89c051e8
5e6f6060
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
780 additions
and
77 deletions
app/build.gradle
app/src/main/AndroidManifest.xml
app/src/main/java/com/vsoft/uofl_catalogue/adapters/MyIncidentsAdapter.java
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/CatalogueCategoryApi.java
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/CatalogueCategoryItemApi.java
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/CatalogueApi.java → app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/CatalogueVariableApi.java
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/IncidentApi.java
app/src/main/java/com/vsoft/uofl_catalogue/api/listeners/get/GetIncidentApiListener.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/CatalogueApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/CatalogueItemApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/CatalogueVariableApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/IncidentApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/LoginApiManger.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/MyRequestApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/UserApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/VariableChoiceApiManager.java
app/src/main/java/com/vsoft/uofl_catalogue/db/models/Incident.java
app/src/main/java/com/vsoft/uofl_catalogue/enums/Impact.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/CatalogueVariableScreen.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/HomeScreen.java
app/src/main/java/com/vsoft/uofl_catalogue/ui/MyIncidentScreen.java
app/src/main/java/com/vsoft/uofl_catalogue/utils/Constants.java
app/src/main/java/com/vsoft/uofl_catalogue/utils/Util.java
app/src/main/res/layout/catalogue_item_screen.xml
app/src/main/res/layout/catalogue_screen.xml
app/src/main/res/layout/my_incident_adapter.xml
app/src/main/res/layout/my_incidents_screen.xml
app/src/main/res/values/colors.xml
app/src/main/res/values/dimen.xml
app/src/main/res/values/strings.xml
app/build.gradle
View file @
ed08d6e6
...
@@ -19,7 +19,7 @@ android {
...
@@ -19,7 +19,7 @@ android {
minSdkVersion
9
minSdkVersion
9
targetSdkVersion
24
targetSdkVersion
24
versionCode
1
versionCode
1
versionName
"0.0.
2
"
versionName
"0.0.
3
"
multiDexEnabled
true
multiDexEnabled
true
}
}
buildTypes
{
buildTypes
{
...
...
app/src/main/AndroidManifest.xml
View file @
ed08d6e6
...
@@ -78,7 +78,9 @@
...
@@ -78,7 +78,9 @@
<activity
<activity
android:name=
".ui.MyRequestActivity"
android:name=
".ui.MyRequestActivity"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:windowSoftInputMode=
"stateHidden|adjustResize"
/>
/>
<activity
android:name=
".ui.MyIncidentScreen"
android:screenOrientation=
"portrait"
/>
</application>
</application>
</manifest>
</manifest>
app/src/main/java/com/vsoft/uofl_catalogue/adapters/MyIncidentsAdapter.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
adapters
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.TextView
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.db.models.Incident
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by kunj on 11/8/16.
*/
public
class
MyIncidentsAdapter
extends
BaseAdapter
{
private
Context
mContext
;
private
final
List
<
Incident
>
mIncidentList
=
new
ArrayList
<>(
0
);
private
LayoutInflater
mInflater
;
public
MyIncidentsAdapter
(
Context
context
)
{
mContext
=
context
;
mInflater
=
(
LayoutInflater
)
mContext
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
}
public
void
setIncidentList
(
List
<
Incident
>
incidentList
)
{
mIncidentList
.
clear
();
if
(
incidentList
!=
null
)
mIncidentList
.
addAll
(
incidentList
);
notifyDataSetChanged
();
}
@Override
public
int
getCount
()
{
// TODO Auto-generated method stub
return
mIncidentList
.
size
();
}
@Override
public
Incident
getItem
(
int
position
)
{
// TODO Auto-generated method stub
return
mIncidentList
.
get
(
position
);
}
@Override
public
long
getItemId
(
int
position
)
{
// TODO Auto-generated method stub
return
position
;
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
// TODO Auto-generated method stub
ViewHolder
holder
;
if
(
convertView
==
null
)
{
convertView
=
mInflater
.
inflate
(
R
.
layout
.
my_incident_adapter
,
parent
,
false
);
holder
=
new
ViewHolder
();
holder
.
numberTextView
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
my_incident_adapter_number_tv
);
holder
.
shortDesTextView
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
my_incident_adapter_short_des_tv
);
holder
.
dateTextView
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
my_incident_adapter_date_tv
);
convertView
.
setTag
(
holder
);
}
else
{
holder
=
(
ViewHolder
)
convertView
.
getTag
();
}
Incident
incident
=
mIncidentList
.
get
(
position
);
holder
.
numberTextView
.
setText
(
incident
.
getNumber
());
holder
.
dateTextView
.
setText
(
incident
.
getOpenedAt
());
holder
.
shortDesTextView
.
setText
(
incident
.
getShortDescription
());
return
convertView
;
}
static
class
ViewHolder
{
private
TextView
numberTextView
;
private
TextView
shortDesTextView
;
private
TextView
dateTextView
;
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/CatalogueCategoryApi.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
api
.
interfaces
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.GET
;
import
retrofit2.http.Query
;
/**
* @since 1.0
* @author Kunj on 11/8/16.
*
*/
public
interface
CatalogueCategoryApi
{
// Get Catalogue API
@GET
(
Constants
.
URL_GET_CATALOGUE
)
Call
<
ResponseBody
>
getCatalogue
(
@Query
(
Constants
.
URL_PARAM_SYSPRM_QUERY
)
String
sysparmQuery
,
@Query
(
Constants
.
URL_PARAM_SYSPRM_FIELDS
)
String
sysParmFields
);
}
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/CatalogueCategoryItemApi.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
api
.
interfaces
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.GET
;
import
retrofit2.http.Query
;
/**
* @since 1.0
* @author Kunj on 11/8/16.
*
*/
public
interface
CatalogueCategoryItemApi
{
// Get Catalogue Item API
@GET
(
Constants
.
URL_GET_CATALOGUE_ITEM
)
Call
<
ResponseBody
>
getCatalogueItem
(
@Query
(
Constants
.
URL_PARAM_SYSPRM_QUERY
)
String
sysparmQuery
,
@Query
(
Constants
.
URL_PARAM_SYSPRM_FIELDS
)
String
sysParmFields
);
}
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/CatalogueApi.java
→
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/Catalogue
Variable
Api.java
View file @
ed08d6e6
...
@@ -19,17 +19,7 @@ import retrofit2.http.Url;
...
@@ -19,17 +19,7 @@ import retrofit2.http.Url;
* @author Kunj on 11/8/16.
* @author Kunj on 11/8/16.
*
*
*/
*/
public
interface
CatalogueApi
{
public
interface
CatalogueVariableApi
{
// Get Catalogue API
@GET
(
Constants
.
URL_GET_CATALOGUE
)
Call
<
ResponseBody
>
getCatalogue
(
@Query
(
Constants
.
URL_PARAM_SYSPRM_QUERY
)
String
sysparmQuery
,
@Query
(
Constants
.
URL_PARAM_SYSPRM_FIELDS
)
String
sysParmFields
);
// Get Catalogue Item API
@GET
(
Constants
.
URL_GET_CATALOGUE_ITEM
)
Call
<
ResponseBody
>
getCatalogueItem
(
@Query
(
Constants
.
URL_PARAM_SYSPRM_QUERY
)
String
sysparmQuery
,
@Query
(
Constants
.
URL_PARAM_SYSPRM_FIELDS
)
String
sysParmFields
);
// Get Variable API
// Get Variable API
@GET
(
Constants
.
URL_GET_VARIABLE
)
@GET
(
Constants
.
URL_GET_VARIABLE
)
Call
<
ResponseBody
>
getVariable
(
@Query
(
CatalogueVariable
.
Json
.
SYS_ID
)
String
sysId
);
Call
<
ResponseBody
>
getVariable
(
@Query
(
CatalogueVariable
.
Json
.
SYS_ID
)
String
sysId
);
...
@@ -47,7 +37,6 @@ public interface CatalogueApi {
...
@@ -47,7 +37,6 @@ public interface CatalogueApi {
// Get Reference API
// Get Reference API
@GET
@GET
Call
<
ResponseBody
>
getReference
(
@Url
String
url
,
@Query
(
Reference
.
Json
.
FIRST_NAME
)
String
firstName
);
Call
<
ResponseBody
>
getReference
(
@Url
String
url
,
@Query
(
Reference
.
Json
.
FIRST_NAME
)
String
firstName
);
}
}
app/src/main/java/com/vsoft/uofl_catalogue/api/interfaces/IncidentApi.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
api
.
interfaces
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.http.GET
;
import
retrofit2.http.Query
;
/**
* @since 1.0
* @author Kunj on 31/8/16.
*
*/
public
interface
IncidentApi
{
// Get Incident API
@GET
(
Constants
.
URL_GET_INCIDENTS
)
Call
<
ResponseBody
>
getIncident
(
@Query
(
Constants
.
URL_PARAM_SYSPRM_QUERY
)
String
sysParmQuery
,
@Query
(
Constants
.
URL_PARAM_SYSPRM_LIMIT
)
String
sysParmLimits
);
}
app/src/main/java/com/vsoft/uofl_catalogue/api/listeners/get/GetIncidentApiListener.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
api
.
listeners
.
get
;
import
com.vsoft.uofl_catalogue.db.models.Incident
;
import
java.util.List
;
/**
* @since 1.0
* @author Kunj on 11/8/16
*
*/
public
interface
GetIncidentApiListener
{
void
onDoneApiCall
(
List
<
Incident
>
incidentList
);
}
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/CatalogueApiManager.java
View file @
ed08d6e6
...
@@ -7,8 +7,8 @@ import com.google.gson.JsonDeserializer;
...
@@ -7,8 +7,8 @@ import com.google.gson.JsonDeserializer;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
com.google.gson.JsonParseException
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.interfaces.CatalogueCategoryApi
;
import
com.vsoft.uofl_catalogue.db.models.Catalogue
;
import
com.vsoft.uofl_catalogue.db.models.Catalogue
;
import
com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueApiListener
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.utils.CatalogueLog
;
import
com.vsoft.uofl_catalogue.utils.CatalogueLog
;
...
@@ -43,7 +43,7 @@ public class CatalogueApiManager {
...
@@ -43,7 +43,7 @@ public class CatalogueApiManager {
CatalogueLog
.
d
(
"CatalogueApiManager: getCatalogues: request parameter: "
+
stringBuilder
.
toString
());
CatalogueLog
.
d
(
"CatalogueApiManager: getCatalogues: request parameter: "
+
stringBuilder
.
toString
());
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueApi
.
class
).
getCatalogue
(
stringBuilder
.
toString
(),
"sys_id,title,description"
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
Catalogue
Category
Api
.
class
).
getCatalogue
(
stringBuilder
.
toString
(),
"sys_id,title,description"
);
try
{
try
{
//Retrofit synchronous call
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
Response
<
ResponseBody
>
response
=
call
.
execute
();
...
...
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/CatalogueItemApiManager.java
View file @
ed08d6e6
...
@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
...
@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
com.google.gson.JsonParseException
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi
;
import
com.vsoft.uofl_catalogue.api.interfaces.Catalogue
CategoryItem
Api
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueItemApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueItemApiListener
;
import
com.vsoft.uofl_catalogue.db.models.CatalogueItem
;
import
com.vsoft.uofl_catalogue.db.models.CatalogueItem
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
...
@@ -43,7 +43,7 @@ public class CatalogueItemApiManager {
...
@@ -43,7 +43,7 @@ public class CatalogueItemApiManager {
CatalogueLog
.
d
(
"CatalogueItemApiManager: getCatalogueItems: request parameter: "
+
stringBuilder
.
toString
());
CatalogueLog
.
d
(
"CatalogueItemApiManager: getCatalogueItems: request parameter: "
+
stringBuilder
.
toString
());
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueApi
.
class
).
getCatalogueItem
(
stringBuilder
.
toString
(),
"sys_id,short_description,name,description"
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
Catalogue
CategoryItem
Api
.
class
).
getCatalogueItem
(
stringBuilder
.
toString
(),
"sys_id,short_description,name,description"
);
try
{
try
{
//Retrofit synchronous call
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
Response
<
ResponseBody
>
response
=
call
.
execute
();
...
@@ -125,26 +125,4 @@ public class CatalogueItemApiManager {
...
@@ -125,26 +125,4 @@ public class CatalogueItemApiManager {
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
}
}
}
public
static
SyncStatus
submitCatalogueItem
(
String
catalogueItemSysId
,
JSONArray
catalogueJsonArray
)
{
CatalogueLog
.
d
(
"submitCatalogueItem: "
+
catalogueJsonArray
);
String
expenseJsonString
=
catalogueJsonArray
.
toString
();
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueApi
.
class
).
postCatalogueItem
(
catalogueItemSysId
,
expenseJsonString
);
try
{
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
if
(
response
.
isSuccessful
())
{
return
SyncStatus
.
SUCCESS
;
}
else
{
return
SyncStatus
.
FAIL
;
}
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"CatalogueItemApiManager: submitCatalogueItem: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
catch
(
NullPointerException
e
){
CatalogueLog
.
e
(
"CatalogueItemApiManager: submitCatalogueItem: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
}
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/CatalogueVariableApiManager.java
View file @
ed08d6e6
...
@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
...
@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
com.google.gson.JsonParseException
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi
;
import
com.vsoft.uofl_catalogue.api.interfaces.Catalogue
Variable
Api
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueVariableApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueVariableApiListener
;
import
com.vsoft.uofl_catalogue.db.models.CatalogueVariable
;
import
com.vsoft.uofl_catalogue.db.models.CatalogueVariable
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
...
@@ -37,7 +37,7 @@ public class CatalogueVariableApiManager {
...
@@ -37,7 +37,7 @@ public class CatalogueVariableApiManager {
public
static
SyncStatus
getCatalogueVariable
(
String
catalogueItemSysId
,
GetCatalogueVariableApiListener
listener
)
{
public
static
SyncStatus
getCatalogueVariable
(
String
catalogueItemSysId
,
GetCatalogueVariableApiListener
listener
)
{
CatalogueLog
.
d
(
"CatalogueVariableApiManager: getCatalogueVariable: "
);
CatalogueLog
.
d
(
"CatalogueVariableApiManager: getCatalogueVariable: "
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueApi
.
class
).
getVariable
(
catalogueItemSysId
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
Catalogue
Variable
Api
.
class
).
getVariable
(
catalogueItemSysId
);
try
{
try
{
//Retrofit synchronous call
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
Response
<
ResponseBody
>
response
=
call
.
execute
();
...
@@ -121,4 +121,26 @@ public class CatalogueVariableApiManager {
...
@@ -121,4 +121,26 @@ public class CatalogueVariableApiManager {
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
}
}
}
public
static
SyncStatus
submitVariableForm
(
String
catalogueItemSysId
,
JSONArray
catalogueJsonArray
)
{
CatalogueLog
.
d
(
"submitVariableForm: "
+
catalogueJsonArray
);
String
expenseJsonString
=
catalogueJsonArray
.
toString
();
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueVariableApi
.
class
).
postCatalogueItem
(
catalogueItemSysId
,
expenseJsonString
);
try
{
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
if
(
response
.
isSuccessful
())
{
return
SyncStatus
.
SUCCESS
;
}
else
{
return
SyncStatus
.
FAIL
;
}
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"CatalogueVariableApiManager: submitVariableForm: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
catch
(
NullPointerException
e
){
CatalogueLog
.
e
(
"CatalogueVariableApiManager: submitVariableForm: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
}
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/IncidentApiManager.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
api
.
managers
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.JsonDeserializationContext
;
import
com.google.gson.JsonDeserializer
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.interfaces.IncidentApi
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetIncidentApiListener
;
import
com.vsoft.uofl_catalogue.db.models.Incident
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.utils.CatalogueLog
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
import
java.util.List
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.Response
;
import
retrofit2.Retrofit
;
/**
* @author Kunj on 31/8/16.
*
*/
public
class
IncidentApiManager
{
public
static
SyncStatus
getIncident
(
GetIncidentApiListener
listener
)
{
CatalogueLog
.
d
(
"IncidentApiManager: getIncident: "
);
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
"caller_id=javascript:gs.getUserID()"
);
CatalogueLog
.
d
(
"IncidentApiManager: getIncident: request parameter: "
+
stringBuilder
.
toString
());
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
IncidentApi
.
class
).
getIncident
(
stringBuilder
.
toString
(),
""
);
try
{
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
if
(
response
.
isSuccessful
())
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
response
.
body
().
string
());
JSONObject
error
=
jsonObject
.
optJSONObject
(
Constants
.
RESPONSE_ERROR_OBJECT_NAME
);
if
(
error
==
null
)
{
JSONArray
incidentJsonArray
=
jsonObject
.
getJSONArray
(
Constants
.
RESPONSE_RESULT_OBJECT_NAME
);
if
(
incidentJsonArray
.
length
()
>
0
)
{
Gson
gson
=
new
GsonBuilder
()
.
excludeFieldsWithoutExposeAnnotation
()
.
registerTypeAdapter
(
long
.
class
,
new
JsonDeserializer
<
Long
>()
{
@Override
public
Long
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
long
value
=
0
;
try
{
value
=
json
.
getAsLong
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
d
(
"IncidentApiManager: getIncident: deserialize: long.class: NumberFormatException: "
);
}
return
value
;
}
})
.
registerTypeAdapter
(
int
.
class
,
new
JsonDeserializer
<
Integer
>()
{
@Override
public
Integer
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
int
value
=
0
;
try
{
value
=
json
.
getAsInt
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
d
(
"IncidentApiManager: getIncident: deserialize: int.class: NumberFormatException: "
);
}
return
value
;
}
})
.
registerTypeAdapter
(
float
.
class
,
new
JsonDeserializer
<
Float
>()
{
@Override
public
Float
deserialize
(
JsonElement
json
,
Type
typeOfT
,
JsonDeserializationContext
context
)
throws
JsonParseException
{
float
value
=
0
;
try
{
value
=
json
.
getAsFloat
();
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
e
(
"IncidentApiManager: getIncident: deserialize: float.class: NumberFormatException: "
,
e
);
}
return
value
;
}
})
.
create
();
List
<
Incident
>
incidentList
=
new
ArrayList
<>(
incidentJsonArray
.
length
());
for
(
int
i
=
0
;
i
<
incidentJsonArray
.
length
();
i
++)
{
JSONObject
expenseJsonObject
=
incidentJsonArray
.
getJSONObject
(
i
);
Incident
incident
=
gson
.
fromJson
(
expenseJsonObject
.
toString
(),
Incident
.
class
);
incident
.
parseJson
(
expenseJsonObject
);
incidentList
.
add
(
incident
);
}
listener
.
onDoneApiCall
(
incidentList
);
}
else
{
listener
.
onDoneApiCall
(
new
ArrayList
<
Incident
>(
0
));
}
return
SyncStatus
.
SUCCESS
;
}
else
return
SyncStatus
.
FAIL
;
}
catch
(
JSONException
e
)
{
CatalogueLog
.
e
(
"IncidentApiManager: getIncident: onResponse: "
,
e
);
return
SyncStatus
.
FAIL
;
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"IncidentApiManager: getIncident: onResponse: "
,
e
);
return
SyncStatus
.
FAIL
;
}
}
else
{
return
SyncStatus
.
FAIL
;
}
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"IncidentApiManager: getIncident: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
catch
(
NullPointerException
e
)
{
CatalogueLog
.
e
(
"IncidentApiManager: getIncident: NullPointerException: "
,
e
);
return
SyncStatus
.
FAIL
;
}
}
}
\ No newline at end of file
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/LoginApiManger.java
View file @
ed08d6e6
...
@@ -29,10 +29,10 @@ public class LoginApiManger {
...
@@ -29,10 +29,10 @@ public class LoginApiManger {
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"
CatalogueItemApiManager: submitCatalogueItem
: IOException: "
,
e
);
CatalogueLog
.
e
(
"
LoginApiManger: submitLoginValues
: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
CatalogueLog
.
e
(
"
CatalogueItemApiManager: submitCatalogueItem
: IOException: "
,
e
);
CatalogueLog
.
e
(
"
LoginApiManger: submitLoginValues
: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
}
}
}
...
...
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/MyRequestApiManager.java
View file @
ed08d6e6
...
@@ -7,25 +7,19 @@ import com.google.gson.JsonDeserializer;
...
@@ -7,25 +7,19 @@ import com.google.gson.JsonDeserializer;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
com.google.gson.JsonParseException
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi
;
import
com.vsoft.uofl_catalogue.api.interfaces.MyRequestApi
;
import
com.vsoft.uofl_catalogue.api.interfaces.MyRequestApi
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener
;
import
com.vsoft.uofl_catalogue.db.models.Catalogue
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
com.vsoft.uofl_catalogue.db.models.MyRequest
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.utils.CatalogueLog
;
import
com.vsoft.uofl_catalogue.utils.CatalogueLog
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
com.vsoft.uofl_catalogue.utils.Constants
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Type
;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
okhttp3.ResponseBody
;
import
okhttp3.ResponseBody
;
import
retrofit2.Call
;
import
retrofit2.Call
;
import
retrofit2.Response
;
import
retrofit2.Response
;
...
...
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/UserApiManager.java
View file @
ed08d6e6
...
@@ -58,7 +58,6 @@ public class UserApiManager {
...
@@ -58,7 +58,6 @@ public class UserApiManager {
try
{
try
{
value
=
json
.
getAsLong
();
value
=
json
.
getAsLong
();
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
d
(
"CatalogueApiManager: getCatalogues: deserialize: long.class: NumberFormatException: "
);
}
}
return
value
;
return
value
;
}
}
...
@@ -70,7 +69,6 @@ public class UserApiManager {
...
@@ -70,7 +69,6 @@ public class UserApiManager {
try
{
try
{
value
=
json
.
getAsInt
();
value
=
json
.
getAsInt
();
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
d
(
"CatalogueApiManager: getCatalogues: deserialize: int.class: NumberFormatException: "
);
}
}
return
value
;
return
value
;
}
}
...
@@ -82,20 +80,19 @@ public class UserApiManager {
...
@@ -82,20 +80,19 @@ public class UserApiManager {
try
{
try
{
value
=
json
.
getAsFloat
();
value
=
json
.
getAsFloat
();
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: deserialize: float.class: NumberFormatException: "
,
e
);
}
}
return
value
;
return
value
;
}
}
})
})
.
create
();
.
create
();
List
<
UserApiValues
>
catalogue
List
=
new
ArrayList
<>(
catalogueJsonArray
.
length
());
List
<
UserApiValues
>
user
List
=
new
ArrayList
<>(
catalogueJsonArray
.
length
());
for
(
int
i
=
0
;
i
<
catalogueJsonArray
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
catalogueJsonArray
.
length
();
i
++)
{
JSONObject
expenseJsonObject
=
catalogueJsonArray
.
getJSONObject
(
i
);
JSONObject
expenseJsonObject
=
catalogueJsonArray
.
getJSONObject
(
i
);
UserApiValues
catalogue
=
gson
.
fromJson
(
expenseJsonObject
.
toString
(),
UserApiValues
.
class
);
UserApiValues
catalogue
=
gson
.
fromJson
(
expenseJsonObject
.
toString
(),
UserApiValues
.
class
);
catalogue
List
.
add
(
catalogue
);
user
List
.
add
(
catalogue
);
}
}
listener
.
onDoneApiCall
(
catalogue
List
);
listener
.
onDoneApiCall
(
user
List
);
}
else
{
}
else
{
listener
.
onDoneApiCall
(
new
ArrayList
<
UserApiValues
>(
0
));
listener
.
onDoneApiCall
(
new
ArrayList
<
UserApiValues
>(
0
));
}
}
...
@@ -103,20 +100,16 @@ public class UserApiManager {
...
@@ -103,20 +100,16 @@ public class UserApiManager {
}
else
}
else
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: onResponse: "
,
e
);
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: onResponse: "
,
e
);
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
}
}
else
{
}
else
{
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: IOException: "
,
e
);
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
CatalogueLog
.
e
(
"CatalogueApiManager: getCatalogues: NullPointerException: "
,
e
);
return
SyncStatus
.
FAIL
;
return
SyncStatus
.
FAIL
;
}
}
}
}
...
...
app/src/main/java/com/vsoft/uofl_catalogue/api/managers/VariableChoiceApiManager.java
View file @
ed08d6e6
...
@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
...
@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonParseException
;
import
com.google.gson.JsonParseException
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.RestClient
;
import
com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi
;
import
com.vsoft.uofl_catalogue.api.interfaces.Catalogue
Variable
Api
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetReferenceApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetReferenceApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetVariableChoiceApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetVariableChoiceApiListener
;
import
com.vsoft.uofl_catalogue.db.models.Reference
;
import
com.vsoft.uofl_catalogue.db.models.Reference
;
...
@@ -45,7 +45,7 @@ public class VariableChoiceApiManager {
...
@@ -45,7 +45,7 @@ public class VariableChoiceApiManager {
CatalogueLog
.
d
(
"VariableChoiceApiManager: getVariableChoice: request parameter: "
+
stringBuilder
.
toString
());
CatalogueLog
.
d
(
"VariableChoiceApiManager: getVariableChoice: request parameter: "
+
stringBuilder
.
toString
());
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueApi
.
class
).
getVariableChoice
(
stringBuilder
.
toString
(),
"text,value,order,misc"
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
Catalogue
Variable
Api
.
class
).
getVariableChoice
(
stringBuilder
.
toString
(),
"text,value,order,misc"
);
try
{
try
{
//Retrofit synchronous call
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
Response
<
ResponseBody
>
response
=
call
.
execute
();
...
@@ -132,7 +132,7 @@ public class VariableChoiceApiManager {
...
@@ -132,7 +132,7 @@ public class VariableChoiceApiManager {
CatalogueLog
.
d
(
"VariableChoiceApiManager: getReference: tableName: "
+
tableName
);
CatalogueLog
.
d
(
"VariableChoiceApiManager: getReference: tableName: "
+
tableName
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
final
Retrofit
retrofit
=
RestClient
.
getInitializedRestAdapter
(
Constants
.
API_AUTH_PARAM_USER_NAME
,
Constants
.
API_AUTH_PARAM_PASSWORD
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
CatalogueApi
.
class
).
getReference
(
Constants
.
URL_GET_REFERENCE
+
tableName
,
firstName
);
Call
<
ResponseBody
>
call
=
retrofit
.
create
(
Catalogue
Variable
Api
.
class
).
getReference
(
Constants
.
URL_GET_REFERENCE
+
tableName
,
firstName
);
try
{
try
{
//Retrofit synchronous call
//Retrofit synchronous call
Response
<
ResponseBody
>
response
=
call
.
execute
();
Response
<
ResponseBody
>
response
=
call
.
execute
();
...
...
app/src/main/java/com/vsoft/uofl_catalogue/db/models/Incident.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
db
.
models
;
import
com.google.gson.annotations.Expose
;
import
com.google.gson.annotations.SerializedName
;
import
com.vsoft.uofl_catalogue.enums.Impact
;
import
com.vsoft.uofl_catalogue.utils.Util
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
/**
* Created by Kunj on 11/8/16.
*/
public
class
Incident
{
@SerializedName
(
"number"
)
@Expose
private
String
number
;
@SerializedName
(
"short_description"
)
@Expose
private
String
shortDescription
;
@SerializedName
(
"opened_at"
)
// @Expose
private
String
openedAt
;
@SerializedName
(
"impact"
)
// @Expose
private
Impact
impact
;
public
Impact
getImpact
()
{
return
impact
;
}
public
void
setImpact
(
Impact
impact
)
{
this
.
impact
=
impact
;
}
public
String
getOpenedAt
()
{
return
openedAt
;
}
public
void
setOpenedAt
(
String
openedAt
)
{
this
.
openedAt
=
openedAt
;
}
public
String
getShortDescription
()
{
return
shortDescription
;
}
public
void
setShortDescription
(
String
shortDescription
)
{
this
.
shortDescription
=
shortDescription
;
}
public
String
getNumber
()
{
return
number
;
}
public
void
setNumber
(
String
number
)
{
this
.
number
=
number
;
}
public
void
parseJson
(
JSONObject
jsonObject
)
{
int
impact
=
-
1
;
String
openedAt
=
null
;
try
{
openedAt
=
jsonObject
.
getString
(
Json
.
OPENED_AT
);
impact
=
jsonObject
.
getInt
(
Json
.
IMPACT
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
this
.
setOpenedAt
(
Util
.
getDateTime
(
openedAt
));
this
.
setImpact
(
Impact
.
from
(
impact
));
}
public
static
final
class
IncidentBuilder
{
private
String
number
;
private
String
shortDescription
;
private
String
openedAt
;
private
Impact
impact
;
private
IncidentBuilder
()
{
}
public
static
IncidentBuilder
anIncident
()
{
return
new
IncidentBuilder
();
}
public
IncidentBuilder
setNumber
(
String
number
)
{
this
.
number
=
number
;
return
this
;
}
public
IncidentBuilder
setShortDescription
(
String
shortDescription
)
{
this
.
shortDescription
=
shortDescription
;
return
this
;
}
public
IncidentBuilder
setOpenedAt
(
String
openedAt
)
{
this
.
openedAt
=
openedAt
;
return
this
;
}
public
IncidentBuilder
setImpact
(
Impact
impact
)
{
this
.
impact
=
impact
;
return
this
;
}
public
IncidentBuilder
but
()
{
return
anIncident
().
setNumber
(
number
).
setShortDescription
(
shortDescription
).
setOpenedAt
(
openedAt
).
setImpact
(
impact
);
}
public
Incident
build
()
{
Incident
incident
=
new
Incident
();
incident
.
setNumber
(
number
);
incident
.
setShortDescription
(
shortDescription
);
incident
.
setOpenedAt
(
openedAt
);
incident
.
setImpact
(
impact
);
return
incident
;
}
}
public
static
class
Json
{
public
static
final
String
IMPACT
=
"impact"
;
public
static
final
String
OPENED_AT
=
"opened_at"
;
}
@Override
public
String
toString
()
{
return
"Incident{"
+
"number='"
+
number
+
'\''
+
", shortDescription='"
+
shortDescription
+
'\''
+
", openedAt='"
+
openedAt
+
'\''
+
", impact="
+
impact
+
'}'
;
}
}
app/src/main/java/com/vsoft/uofl_catalogue/enums/Impact.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
enums
;
/**
* @since 1.0
* @author Kunj on 30/8/16.
*
*/
public
enum
Impact
{
UNKNOWN
(-
1
),
HIGH
(
1
),
MEDIUM
(
2
),
LOW
(
3
);
int
id
;
Impact
(
int
id
)
{
this
.
id
=
id
;
}
public
static
int
getSyncStatus
(
Impact
status
)
{
return
status
.
id
;
}
public
int
getId
()
{
return
this
.
id
;
}
public
static
Impact
from
(
int
id
)
{
for
(
int
i
=
0
;
i
<
Impact
.
values
().
length
;
i
++)
{
Impact
impact
=
Impact
.
values
()[
i
];
if
(
impact
.
id
==
id
)
return
Impact
.
values
()[
i
];
}
return
UNKNOWN
;
}
}
app/src/main/java/com/vsoft/uofl_catalogue/ui/CatalogueVariableScreen.java
View file @
ed08d6e6
...
@@ -28,7 +28,6 @@ import com.vsoft.uofl_catalogue.CatalogueApplication;
...
@@ -28,7 +28,6 @@ import com.vsoft.uofl_catalogue.CatalogueApplication;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueVariableApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueVariableApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetVariableChoiceApiListener
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetVariableChoiceApiListener
;
import
com.vsoft.uofl_catalogue.api.managers.CatalogueItemApiManager
;
import
com.vsoft.uofl_catalogue.api.managers.CatalogueVariableApiManager
;
import
com.vsoft.uofl_catalogue.api.managers.CatalogueVariableApiManager
;
import
com.vsoft.uofl_catalogue.api.managers.VariableChoiceApiManager
;
import
com.vsoft.uofl_catalogue.api.managers.VariableChoiceApiManager
;
import
com.vsoft.uofl_catalogue.db.models.CatalogueVariable
;
import
com.vsoft.uofl_catalogue.db.models.CatalogueVariable
;
...
@@ -463,7 +462,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
...
@@ -463,7 +462,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override
@Override
protected
SyncStatus
doInBackground
(
String
...
params
)
{
protected
SyncStatus
doInBackground
(
String
...
params
)
{
SyncStatus
syncStatus
=
Catalogue
ItemApiManager
.
submitCatalogueIte
m
(
mCatalogueItemSysId
,
mJsonArray
);
SyncStatus
syncStatus
=
Catalogue
VariableApiManager
.
submitVariableFor
m
(
mCatalogueItemSysId
,
mJsonArray
);
return
syncStatus
;
return
syncStatus
;
}
}
...
...
app/src/main/java/com/vsoft/uofl_catalogue/ui/HomeScreen.java
View file @
ed08d6e6
...
@@ -42,7 +42,9 @@ public class HomeScreen extends Activity {
...
@@ -42,7 +42,9 @@ public class HomeScreen extends Activity {
startActivity
(
new
Intent
(
HomeScreen
.
this
,
ReportIncidentScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
ReportIncidentScreen
.
class
));
}
else
if
(
position
==
1
)
{
}
else
if
(
position
==
1
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
CatalogueScreen
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
CatalogueScreen
.
class
));
}
else
if
(
position
==
3
)
{
}
else
if
(
position
==
2
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyIncidentScreen
.
class
));
}
else
if
(
position
==
3
)
{
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyRequestActivity
.
class
));
startActivity
(
new
Intent
(
HomeScreen
.
this
,
MyRequestActivity
.
class
));
}
}
}
}
...
...
app/src/main/java/com/vsoft/uofl_catalogue/ui/MyIncidentScreen.java
0 → 100644
View file @
ed08d6e6
package
com
.
vsoft
.
uofl_catalogue
.
ui
;
import
android.app.ProgressDialog
;
import
android.content.DialogInterface
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.view.MenuItem
;
import
android.widget.ListView
;
import
com.vsoft.uofl_catalogue.CatalogueApplication
;
import
com.vsoft.uofl_catalogue.R
;
import
com.vsoft.uofl_catalogue.adapters.MyIncidentsAdapter
;
import
com.vsoft.uofl_catalogue.api.listeners.get.GetIncidentApiListener
;
import
com.vsoft.uofl_catalogue.api.managers.IncidentApiManager
;
import
com.vsoft.uofl_catalogue.db.models.Incident
;
import
com.vsoft.uofl_catalogue.enums.SyncStatus
;
import
com.vsoft.uofl_catalogue.utils.CatalogueLog
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnItemClick
;
/**
* Created by kunj on 30/8/16.
*/
public
class
MyIncidentScreen
extends
AppCompatActivity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
my_incidents_screen_list_view
)
ListView
mListView
;
private
CatalogueApplication
mApplication
;
private
List
<
Incident
>
mIncidentList
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
// TODO Auto-generated method stub
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
my_incidents_screen
);
ButterKnife
.
bind
(
this
);
mApplication
=
(
CatalogueApplication
)
getApplication
();
setSupportActionBar
(
mToolbar
);
ActionBar
actionBar
=
getSupportActionBar
();
if
(
actionBar
!=
null
)
{
actionBar
.
setDisplayHomeAsUpEnabled
(
true
);
actionBar
.
setElevation
(
0
);
actionBar
.
setTitle
(
R
.
string
.
my_incidents_text_string
);
actionBar
.
setDisplayShowHomeEnabled
(
false
);
actionBar
.
setDisplayShowTitleEnabled
(
true
);
}
if
(
mApplication
.
isNetConnected
())
{
new
FetchIncident
().
execute
();
}
else
{
showErrorDialog
(
R
.
string
.
internet_validation_string
);
}
}
@OnItemClick
(
R
.
id
.
my_incidents_screen_list_view
)
void
listViewOnClicked
(
int
position
)
{
Incident
incident
=
mIncidentList
.
get
(
position
);
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
"Number: "
);
stringBuilder
.
append
(
incident
.
getNumber
());
stringBuilder
.
append
(
"\n\n"
);
stringBuilder
.
append
(
"Opened At: "
);
stringBuilder
.
append
(
incident
.
getOpenedAt
());
stringBuilder
.
append
(
"\n\n"
);
stringBuilder
.
append
(
"Short Description: "
);
stringBuilder
.
append
(
incident
.
getShortDescription
());
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setMessage
(
stringBuilder
.
toString
())
.
setCancelable
(
false
)
.
setPositiveButton
(
android
.
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
dialog
.
dismiss
();
}
});
AlertDialog
alert
=
builder
.
create
();
alert
.
show
();
}
class
FetchIncident
extends
AsyncTask
<
String
,
Void
,
SyncStatus
>
{
private
ProgressDialog
progressDialog
;
@Override
protected
void
onPreExecute
()
{
super
.
onPreExecute
();
progressDialog
=
new
ProgressDialog
(
MyIncidentScreen
.
this
);
progressDialog
.
setMessage
(
getString
(
R
.
string
.
loading_string
));
progressDialog
.
show
();
progressDialog
.
setCancelable
(
false
);
}
@Override
protected
SyncStatus
doInBackground
(
String
...
params
)
{
SyncStatus
syncStatus
=
IncidentApiManager
.
getIncident
(
new
GetIncidentApiListener
()
{
@Override
public
void
onDoneApiCall
(
List
<
Incident
>
incidentList
)
{
CatalogueLog
.
e
(
"Data: incidentList: "
+
incidentList
);
mIncidentList
=
incidentList
;
}
});
return
syncStatus
;
}
@Override
protected
void
onPostExecute
(
SyncStatus
syncStatus
)
{
super
.
onPostExecute
(
syncStatus
);
if
(
progressDialog
!=
null
&&
progressDialog
.
isShowing
())
{
progressDialog
.
dismiss
();
}
if
(
syncStatus
==
SyncStatus
.
SUCCESS
)
{
if
(
mIncidentList
!=
null
)
setData
(
mIncidentList
);
}
else
{
showErrorDialog
(
R
.
string
.
failed_to_fetch_incident_string
);
}
}
}
private
void
setData
(
final
List
<
Incident
>
catalogueList
)
{
MyIncidentsAdapter
adapter
=
new
MyIncidentsAdapter
(
MyIncidentScreen
.
this
);
adapter
.
setIncidentList
(
catalogueList
);
mListView
.
setAdapter
(
adapter
);
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
menuItem
)
{
if
(
menuItem
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
finish
();
}
return
super
.
onOptionsItemSelected
(
menuItem
);
}
private
void
showErrorDialog
(
int
message
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setMessage
(
message
)
.
setCancelable
(
false
)
.
setPositiveButton
(
android
.
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
finish
();
}
});
AlertDialog
alert
=
builder
.
create
();
alert
.
show
();
}
}
app/src/main/java/com/vsoft/uofl_catalogue/utils/Constants.java
View file @
ed08d6e6
...
@@ -26,6 +26,7 @@ public class Constants {
...
@@ -26,6 +26,7 @@ public class Constants {
public
static
final
String
URL_PARAM_SYSPRM_QUERY
=
"sysparm_query"
;
public
static
final
String
URL_PARAM_SYSPRM_QUERY
=
"sysparm_query"
;
public
static
final
String
URL_PARAM_SYSPRM_FIELDS
=
"sysparm_fields"
;
public
static
final
String
URL_PARAM_SYSPRM_FIELDS
=
"sysparm_fields"
;
public
static
final
String
URL_PARAM_SYSPRM_USERNAME
=
"user_name"
;
public
static
final
String
URL_PARAM_SYSPRM_USERNAME
=
"user_name"
;
public
static
final
String
URL_PARAM_SYSPRM_LIMIT
=
"sysparm_limit"
;
/**
/**
* Debug logs
* Debug logs
...
@@ -106,14 +107,23 @@ public class Constants {
...
@@ -106,14 +107,23 @@ public class Constants {
/**
/**
* Catalogue web services urls
* Catalogue web services urls
*/
*/
/*Login API */
public
static
final
String
URL_POST_LOGIN_ITEM
=
"/oauth_token.do"
;
/*Catalogue Category API */
public
static
final
String
URL_GET_CATALOGUE
=
API_PATH
+
"sc_category"
;
public
static
final
String
URL_GET_CATALOGUE
=
API_PATH
+
"sc_category"
;
/*Catalogue Category Items API */
public
static
final
String
URL_GET_CATALOGUE_ITEM
=
API_PATH
+
"sc_cat_item"
;
public
static
final
String
URL_GET_CATALOGUE_ITEM
=
API_PATH
+
"sc_cat_item"
;
/*Variable form API */
public
static
final
String
URL_GET_VARIABLE
=
"/api/uno33/uofl_mobile/variables"
;
public
static
final
String
URL_GET_VARIABLE
=
"/api/uno33/uofl_mobile/variables"
;
public
static
final
String
URL_GET_VARIABLE_CHOICE
=
API_PATH
+
"question_choice"
;
public
static
final
String
URL_GET_VARIABLE_CHOICE
=
API_PATH
+
"question_choice"
;
public
static
final
String
URL_POST_CATALOGUE_ITEM
=
"api/uno33/uofl_mobile"
;
public
static
final
String
URL_POST_CATALOGUE_ITEM
=
"api/uno33/uofl_mobile"
;
public
static
final
String
URL_GET_REFERENCE
=
API_PATH
;
public
static
final
String
URL_GET_REFERENCE
=
API_PATH
;
public
static
final
String
URL_POST_LOGIN_ITEM
=
"/oauth_token.do"
;
public
static
final
String
URL_GET_MYREQUEST
=
API_PATH
+
"sc_req_item"
;
public
static
final
String
URL_GET_MYREQUEST
=
API_PATH
+
"sc_req_item"
;
public
static
final
String
URL_GET_USERDETAILS
=
API_PATH
+
"sys_user"
;
public
static
final
String
URL_GET_USERDETAILS
=
API_PATH
+
"sys_user"
;
/*Incident API */
public
static
final
String
URL_GET_INCIDENTS
=
API_PATH
+
"incident"
;
}
}
app/src/main/java/com/vsoft/uofl_catalogue/utils/Util.java
View file @
ed08d6e6
...
@@ -224,7 +224,7 @@ public class Util {
...
@@ -224,7 +224,7 @@ public class Util {
public
static
String
getDefaultDate
()
{
public
static
String
getDefaultDate
()
{
Calendar
c
=
Calendar
.
getInstance
();
Calendar
c
=
Calendar
.
getInstance
();
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"dd MMM, yyyy"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"dd MMM, yyyy"
,
Locale
.
US
);
String
formattedDate
=
df
.
format
(
c
.
getTime
());
String
formattedDate
=
df
.
format
(
c
.
getTime
());
return
formattedDate
;
return
formattedDate
;
}
}
...
@@ -238,7 +238,7 @@ public class Util {
...
@@ -238,7 +238,7 @@ public class Util {
}
}
public
static
long
getDateFromString
(
String
strDate
)
{
public
static
long
getDateFromString
(
String
strDate
)
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"dd MMM, yyyy"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"dd MMM, yyyy"
,
Locale
.
US
);
Date
date
=
null
;
Date
date
=
null
;
try
{
try
{
date
=
df
.
parse
(
strDate
);
date
=
df
.
parse
(
strDate
);
...
@@ -250,12 +250,12 @@ public class Util {
...
@@ -250,12 +250,12 @@ public class Util {
public
static
String
getDateFromLong
(
long
timeStamp
)
{
public
static
String
getDateFromLong
(
long
timeStamp
)
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
,
Locale
.
getDefault
()
);
(
"yyyy-MM-dd"
,
Locale
.
US
);
return
dateFormat
.
format
(
timeStamp
);
return
dateFormat
.
format
(
timeStamp
);
}
}
public
static
long
getDateTimeFromString
(
String
strDate
)
{
public
static
long
getDateTimeFromString
(
String
strDate
)
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"dd MMM, yyyy HH:mm"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"dd MMM, yyyy HH:mm"
,
Locale
.
US
);
Date
date
=
null
;
Date
date
=
null
;
try
{
try
{
date
=
df
.
parse
(
strDate
);
date
=
df
.
parse
(
strDate
);
...
@@ -267,10 +267,24 @@ public class Util {
...
@@ -267,10 +267,24 @@ public class Util {
public
static
String
getDateTimeFromLong
(
long
timeStamp
)
{
public
static
String
getDateTimeFromLong
(
long
timeStamp
)
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"dd MMM, yyyy HH:mm"
,
Locale
.
getDefault
()
);
(
"dd MMM, yyyy HH:mm"
,
Locale
.
US
);
return
dateFormat
.
format
(
timeStamp
);
return
dateFormat
.
format
(
timeStamp
);
}
}
public
static
String
getDateTime
(
String
strDate
)
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
,
Locale
.
US
);
Date
date
=
null
;
try
{
date
=
df
.
parse
(
strDate
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"dd MMM, yyyy HH:mm"
,
Locale
.
US
);
return
dateFormat
.
format
(
date
.
getTime
());
}
public
static
void
hideSoftKeyboard
(
Context
context
,
View
view
)
{
public
static
void
hideSoftKeyboard
(
Context
context
,
View
view
)
{
InputMethodManager
imm
=(
InputMethodManager
)
context
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
InputMethodManager
imm
=(
InputMethodManager
)
context
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
imm
.
hideSoftInputFromWindow
(
view
.
getWindowToken
(),
0
);
imm
.
hideSoftInputFromWindow
(
view
.
getWindowToken
(),
0
);
...
...
app/src/main/res/layout/catalogue_item_screen.xml
View file @
ed08d6e6
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
android:layout_margin=
"@dimen/normal_margin"
android:layout_margin=
"@dimen/normal_margin"
android:background=
"@android:color/white"
android:background=
"@android:color/white"
android:divider=
"@android:color/white"
android:divider=
"@android:color/white"
android:dividerHeight=
"@dimen/list_view_divider_height"
android:dividerHeight=
"@dimen/
catalogue_category_and_item_
list_view_divider_height"
android:padding=
"@dimen/normal_margin"
android:padding=
"@dimen/normal_margin"
android:scrollbars=
"none"
android:scrollbars=
"none"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
...
...
app/src/main/res/layout/catalogue_screen.xml
View file @
ed08d6e6
...
@@ -30,6 +30,6 @@
...
@@ -30,6 +30,6 @@
android:layout_margin=
"@dimen/normal_margin"
android:layout_margin=
"@dimen/normal_margin"
android:padding=
"@dimen/normal_margin"
android:padding=
"@dimen/normal_margin"
android:divider=
"@android:color/white"
android:divider=
"@android:color/white"
android:dividerHeight=
"@dimen/list_view_divider_height"
android:dividerHeight=
"@dimen/
catalogue_category_and_item_
list_view_divider_height"
android:scrollbars=
"none"
/>
android:scrollbars=
"none"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/my_incident_adapter.xml
0 → 100644
View file @
ed08d6e6
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"@dimen/small_margin"
>
<TextView
android:id=
"@+id/my_incident_adapter_number_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"@dimen/extra_normal_text_size"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/my_incident_adapter_date_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:textSize=
"@dimen/normal_text_size"
/>
<TextView
android:id=
"@+id/my_incident_adapter_short_des_tv"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/my_incident_adapter_number_tv"
android:layout_marginTop=
"@dimen/small_margin"
android:textSize=
"@dimen/normal_text_size"
android:lines=
"3"
android:ellipsize=
"end"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/my_incidents_screen.xml
0 → 100644
View file @
ed08d6e6
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/screen_bg_color"
>
<android.support.v7.widget.Toolbar
android:id=
"@+id/tool_bar_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:background=
"@android:color/white"
android:minHeight=
"?attr/actionBarSize"
android:padding=
"0dp"
android:contentInsetEnd=
"0dp"
android:contentInsetRight=
"0dp"
android:contentInsetStart=
"0dp"
app:contentInsetEnd=
"0dp"
app:contentInsetLeft=
"0dp"
app:contentInsetRight=
"0dp"
app:contentInsetStart=
"0dp"
/>
<ListView
android:id=
"@+id/my_incidents_screen_list_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
android:layout_margin=
"@dimen/normal_margin"
android:padding=
"@dimen/normal_margin"
android:divider=
"@color/divider_color"
android:dividerHeight=
"@dimen/list_view_divider_height"
android:scrollbars=
"none"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
ed08d6e6
...
@@ -17,4 +17,5 @@
...
@@ -17,4 +17,5 @@
<color
name=
"back_button_bg_color"
>
#4f0307
</color>
<color
name=
"back_button_bg_color"
>
#4f0307
</color>
<color
name=
"submit_button_bg_color"
>
#e31b22
</color>
<color
name=
"submit_button_bg_color"
>
#e31b22
</color>
<color
name=
"divider_color"
>
#c9c8cc
</color>
</resources>
</resources>
app/src/main/res/values/dimen.xml
View file @
ed08d6e6
...
@@ -11,7 +11,8 @@
...
@@ -11,7 +11,8 @@
<dimen
name=
"extra_normal_text_size"
>
24sp
</dimen>
<dimen
name=
"extra_normal_text_size"
>
24sp
</dimen>
<dimen
name=
"large_text_size"
>
20sp
</dimen>
<dimen
name=
"large_text_size"
>
20sp
</dimen>
<dimen
name=
"list_view_divider_height"
>
5dp
</dimen>
<dimen
name=
"catalogue_category_and_item_list_view_divider_height"
>
5dp
</dimen>
<dimen
name=
"list_view_divider_height"
>
1dp
</dimen>
<!--Home Screen-->
<!--Home Screen-->
<dimen
name=
"home_screen_item_height"
>
120dp
</dimen>
<dimen
name=
"home_screen_item_height"
>
120dp
</dimen>
...
...
app/src/main/res/values/strings.xml
View file @
ed08d6e6
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
<string
name=
"failed_to_fetch_variable_choice_string"
>
Failed to fetch Choice Items.
</string>
<string
name=
"failed_to_fetch_variable_choice_string"
>
Failed to fetch Choice Items.
</string>
<string
name=
"failed_to_fetch_reference_string"
>
Failed to fetch References.
</string>
<string
name=
"failed_to_fetch_reference_string"
>
Failed to fetch References.
</string>
<string
name=
"failed_to_submit_form_string"
>
Failed to submit form.
</string>
<string
name=
"failed_to_submit_form_string"
>
Failed to submit form.
</string>
<string
name=
"failed_to_fetch_incident_string"
>
Failed to fetch Incident.
</string>
<!--Login Screen-->
<!--Login Screen-->
<string
name=
"login_screen_user_name_string"
>
Username
</string>
<string
name=
"login_screen_user_name_string"
>
Username
</string>
...
@@ -48,4 +49,6 @@
...
@@ -48,4 +49,6 @@
<string
name=
"incident_form_impact_text_string"
>
Impact
</string>
<string
name=
"incident_form_impact_text_string"
>
Impact
</string>
<string
name=
"incident_form_describe_your_issue_text_string"
>
Please Describe Your Issue below
</string>
<string
name=
"incident_form_describe_your_issue_text_string"
>
Please Describe Your Issue below
</string>
<!--My Incidents-->
<string
name=
"my_incidents_text_string"
>
My Incidents
</string>
</resources>
</resources>
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