com.vodafone360.people.service.interfaces
Class IPeopleServiceImpl

java.lang.Object
  extended by com.vodafone360.people.service.interfaces.IPeopleServiceImpl
All Implemented Interfaces:
BaseEngine.IEngineEventCallback, IPeopleService

public class IPeopleServiceImpl
extends java.lang.Object
implements IPeopleService, BaseEngine.IEngineEventCallback

See Also:
BaseEngine.IEngineEventCallback, IPeopleService

Field Summary
private  ApplicationCache mApplicationCache
           
private  UiAgent mHandlerAgent
           
private  NetworkAgent mNetworkAgent
           
private  RemoteService mService
           
private  java.util.List<Handler> mUiEventCallbackList
           
private  IWorkerThreadControl mWorkerThreadControl
           
 
Constructor Summary
IPeopleServiceImpl(IWorkerThreadControl workerThreadControl, RemoteService service)
          Initialises the object, creating the UiAgent.
 
Method Summary
 void addEventCallback(Handler uiHandler)
          Allows the Activity to register a Handler, so that it can receive new call back events from the Service layer.
 void checkForUpdates()
          Push the UpdateEngine to immediately check for an updated version of the client.
 void downloadMeProfileFirstTime()
          This method triggers the Me Profile download, is currently called by UI
 void fetchAvailableIdentities(Bundle data)
          Begins the process of retrieving all Third party Accounts from the Vodafone 360 back end.
 void fetchMyIdentities(Bundle data)
          Begins the process of retrieving Third party Accounts that the user is already registered with from the Vodafone 360 back end.
 void fetchPrivacyStatement()
          Fetched the current Privacy Statement information from the Vodafone 360 back end system.
 void fetchTermsOfService()
          Fetched the current Terms of Service information from the Vodafone 360 back end system.
 void fetchUsernameState(java.lang.String userName)
          Asks the back end server to check the validity of the given user name.
 ApplicationCache getApplicationCache()
          Returns the ApplicationCache, for storing data.
 boolean getLoginRequired()
          Called by the UI to determine if the Service is currently logged into the Vodafone 360 back end.
 void getMoreTimelines()
          This method should be called to retrieve older timelines in TimelineListActivity, @see ActivitiesEngine.
 NetworkAgentState getNetworkAgentState()
          Returns the current state of the Network Agent.
 void getOlderStatuses()
          This method should be called to retrieve older statuses in StatusListActivity, @see ActivitiesEngine.
 void getPresenceList(long contactId)
          Request a refresh of the currently known Presence information (used for testing only)
 boolean getRoamingDeviceSetting()
          Gets the current IS_ROAMING_ALLOWED value for the device, which is set by the user in the "Menu > Settings > Wireless Controls > Mobile network settings > Data roaming" check box.
 int getRoamingNotificationType()
          Gets the type of roaming notification to show to the user
 void getStatuses()
          This method should be called to retrieve status updates in StatusListActivity, @see ActivitiesEngine.
 UiAgent getUiAgent()
          Returns the UiAgent, for sending unsolicited messages to the UI.
 void kickWorkerThread()
          Restarts the WorkerThread if it is in a sleeping or suspended state, ignored otherwise.
 void logon(LoginDetails loginDetails)
          Log into the Vodafone 360 back end system using the given credentials.
 void notifyDataSettingChanged(PersistSettings.InternetAvail val)
          Sets the current Data connectivity preference (i.e. connect, connect when not roaming, or never connect), although this value is ignored during initial sign up.
 void onUiEvent(ServiceUiRequest event, int arg1, int arg2, java.lang.Object data)
          Handle an incoming UI Event.
 void pingUserActivity()
          Pings the service about user activity.
 void register(RegistrationDetails details)
          Signs up a new user to the Vodafone 360 back end using the given Registration details.
 void removeEventCallback(Handler uiHandler)
          Allows the Activity to unregister a Handler, so it will no longer receive call back events from the Service layer.
 void sendMessage(long localContactId, java.lang.String body, int networkId)
          This method should be used to send a message to a contact
 void setAvailability(java.util.Hashtable<java.lang.String,java.lang.String> myself)
          Alter the current Social Network availability state and send it to the server.
 void setIdentityStatus(java.lang.String network, java.lang.String identityId, boolean identityStatus)
          Calls the set identity capability status API
 void setNetworkAgent(NetworkAgent agent)
          Sets the ServiceAgent, as this needs to be called after the constructor.
 void setNetworkAgentState(NetworkAgentState state)
          Overrides the current state of the Network Agent.
 void setNewUpdateFrequency()
          Push the UpdateEngine to check if a new update frequency has been set and to act accordingly.
 void setShowRoamingNotificationAgain(boolean showAgain)
          Sets a preference that disables the showing of further roaming notifications.
 void startBackgroundContactSync(long delay)
          Begins the process of synchronising contacts with the Vodafone 360 back end.
 void startContactSync()
          Begins the process of synchronising contacts with the Vodafone 360 back end.
 void startStatusesSync()
          Push the ActivitiesEngine Engine to begin synchronising Activities
 void subscribe(Handler handler, java.lang.Long contactId, boolean chat)
          Allows an Activity to indicate to the Service that it is ready and able to handle incoming unsolicited UI events.
 void unsubscribe(Handler handler)
          Allows the Activity to indicate that it is no longer in the foreground and will not handle incoming UI events correctly.
 void updateChatNotification(long localContactId)
          This method should be called to update the Chat Notifications.
 void uploadMeProfile()
          This method triggers the Me Profile upload
 void uploadMyStatus(java.lang.String statusText)
          This method triggers the Me Profile status text upload
 void validateIdentityCredentials(boolean dryRun, java.lang.String network, java.lang.String username, java.lang.String password, Bundle identityCapabilityStatus)
          Validate the given Social Network identity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mUiEventCallbackList

private final java.util.List<Handler> mUiEventCallbackList

mWorkerThreadControl

private IWorkerThreadControl mWorkerThreadControl

mService

private RemoteService mService

mNetworkAgent

private NetworkAgent mNetworkAgent

mHandlerAgent

private UiAgent mHandlerAgent

mApplicationCache

private ApplicationCache mApplicationCache
Constructor Detail

IPeopleServiceImpl

public IPeopleServiceImpl(IWorkerThreadControl workerThreadControl,
                          RemoteService service)
Initialises the object, creating the UiAgent.

Parameters:
workerThreadControl - Provides access to worker thread control functions.
service - Provides access to remote service functions (mainly used to retrieve context).
Method Detail

setNetworkAgent

public void setNetworkAgent(NetworkAgent agent)
Sets the ServiceAgent, as this needs to be called after the constructor.

Parameters:
agent - Handle to ServiceAgent.

onUiEvent

public void onUiEvent(ServiceUiRequest event,
                      int arg1,
                      int arg2,
                      java.lang.Object data)
Description copied from interface: BaseEngine.IEngineEventCallback
Handle an incoming UI Event.

Specified by:
onUiEvent in interface BaseEngine.IEngineEventCallback
Parameters:
event - ServiceUiRequest - e.g. UI request complete.
arg1 - ID of associated request.
arg2 - status of request (success or error code).
data - object Data associated with completed request.
See Also:
com.vodafone360.people.engine.BaseEngine.IEngineEventCallback#onUiEvent(UiEvent, int, int, Object)

kickWorkerThread

public void kickWorkerThread()
Description copied from interface: BaseEngine.IEngineEventCallback
Restarts the WorkerThread if it is in a sleeping or suspended state, ignored otherwise. This method is called by various events including: new UI or network events or a wake up alarm set by an engine requiring periodic activity.

Specified by:
kickWorkerThread in interface BaseEngine.IEngineEventCallback
See Also:
BaseEngine.IEngineEventCallback.kickWorkerThread()

addEventCallback

public void addEventCallback(Handler uiHandler)
Description copied from interface: IPeopleService
Allows the Activity to register a Handler, so that it can receive new call back events from the Service layer.

Specified by:
addEventCallback in interface IPeopleService
See Also:
IPeopleService.addEventCallback(Handler)

removeEventCallback

public void removeEventCallback(Handler uiHandler)
Description copied from interface: IPeopleService
Allows the Activity to unregister a Handler, so it will no longer receive call back events from the Service layer. Usually called on an Activity's onDestroy() method.

Specified by:
removeEventCallback in interface IPeopleService
See Also:
IPeopleService.removeEventCallback(Handler)

checkForUpdates

public void checkForUpdates()
Description copied from interface: IPeopleService
Push the UpdateEngine to immediately check for an updated version of the client.

Specified by:
checkForUpdates in interface IPeopleService
See Also:
IPeopleService.checkForUpdates()

fetchAvailableIdentities

public void fetchAvailableIdentities(Bundle data)
Description copied from interface: IPeopleService
Begins the process of retrieving all Third party Accounts from the Vodafone 360 back end. The response is sent to any currently registered Activity handlers.

Specified by:
fetchAvailableIdentities in interface IPeopleService
See Also:
IPeopleService.fetchAvailableIdentities(Bundle)

fetchMyIdentities

public void fetchMyIdentities(Bundle data)
Description copied from interface: IPeopleService
Begins the process of retrieving Third party Accounts that the user is already registered with from the Vodafone 360 back end. The response is sent to any currently registered Activity handlers.

Specified by:
fetchMyIdentities in interface IPeopleService
See Also:
IPeopleService.fetchMyIdentities(Bundle)

fetchPrivacyStatement

public void fetchPrivacyStatement()
Description copied from interface: IPeopleService
Fetched the current Privacy Statement information from the Vodafone 360 back end system. The result is sent to the registered Handler some time later after the download process has finished.

Specified by:
fetchPrivacyStatement in interface IPeopleService
See Also:
IPeopleService.fetchPrivacyStatement()

fetchTermsOfService

public void fetchTermsOfService()
Description copied from interface: IPeopleService
Fetched the current Terms of Service information from the Vodafone 360 back end system. The result is sent to the registered Handler some time later after the download process has finished.

Specified by:
fetchTermsOfService in interface IPeopleService
See Also:
IPeopleService.fetchTermsOfService()

fetchUsernameState

public void fetchUsernameState(java.lang.String userName)
Description copied from interface: IPeopleService
Asks the back end server to check the validity of the given user name.

Specified by:
fetchUsernameState in interface IPeopleService
See Also:
IPeopleService.fetchUsernameState(String)

getLoginRequired

public boolean getLoginRequired()
Description copied from interface: IPeopleService
Called by the UI to determine if the Service is currently logged into the Vodafone 360 back end. Called by the StartActivity and other key classes, so the work flow can be diverted back to the Landing page if the user has been signed out for any reason.

Specified by:
getLoginRequired in interface IPeopleService
Returns:
TRUE Service is logged into the back end system, FALSE user must log in before they can use the Application.
See Also:
IPeopleService.getLoginRequired()

getRoamingNotificationType

public int getRoamingNotificationType()
Description copied from interface: IPeopleService
Gets the type of roaming notification to show to the user

Specified by:
getRoamingNotificationType in interface IPeopleService
Returns:
ROAMING_DIALOG_GLOBAL_ON Data roaming is on, ROAMING_DIALOG_GLOBAL_OFF Data roaming is off
See Also:
IPeopleService.getRoamingNotificationType()

getRoamingDeviceSetting

public boolean getRoamingDeviceSetting()
Description copied from interface: IPeopleService
Gets the current IS_ROAMING_ALLOWED value for the device, which is set by the user in the "Menu > Settings > Wireless Controls > Mobile network settings > Data roaming" check box.

Specified by:
getRoamingDeviceSetting in interface IPeopleService
Returns:
TRUE when roaming is permitted, FALSE when roaming is not permitted.
See Also:
IPeopleService.getRoamingDeviceSetting()

notifyDataSettingChanged

public void notifyDataSettingChanged(PersistSettings.InternetAvail val)
Description copied from interface: IPeopleService
Sets the current Data connectivity preference (i.e. connect, connect when not roaming, or never connect), although this value is ignored during initial sign up.

Specified by:
notifyDataSettingChanged in interface IPeopleService
See Also:
com.vodafone360.people.service.interfaces.IPeopleService#notifyDataSettingChanged(InternetAvail)

logon

public void logon(LoginDetails loginDetails)
Description copied from interface: IPeopleService
Log into the Vodafone 360 back end system using the given credentials.

Specified by:
logon in interface IPeopleService
See Also:
IPeopleService.logon(LoginDetails)

register

public void register(RegistrationDetails details)
Description copied from interface: IPeopleService
Signs up a new user to the Vodafone 360 back end using the given Registration details.

Specified by:
register in interface IPeopleService
See Also:
IPeopleService.register(RegistrationDetails)

setNewUpdateFrequency

public void setNewUpdateFrequency()
Description copied from interface: IPeopleService
Push the UpdateEngine to check if a new update frequency has been set and to act accordingly.

Specified by:
setNewUpdateFrequency in interface IPeopleService
See Also:
IPeopleService.setNewUpdateFrequency()

setShowRoamingNotificationAgain

public void setShowRoamingNotificationAgain(boolean showAgain)
Description copied from interface: IPeopleService
Sets a preference that disables the showing of further roaming notifications.

Specified by:
setShowRoamingNotificationAgain in interface IPeopleService
See Also:
IPeopleService.setShowRoamingNotificationAgain(boolean)

startContactSync

public void startContactSync()
Description copied from interface: IPeopleService
Begins the process of synchronising contacts with the Vodafone 360 back end. This is designed to run in the foreground and be shown to the user during the initial sign up process.

Specified by:
startContactSync in interface IPeopleService
See Also:
IPeopleService.startContactSync()

startBackgroundContactSync

public void startBackgroundContactSync(long delay)
Description copied from interface: IPeopleService
Begins the process of synchronising contacts with the Vodafone 360 back end. This is designed to run in the background and is called every time the ContactListActivity is shown to the user.

Specified by:
startBackgroundContactSync in interface IPeopleService
Parameters:
delay - the delay in milliseconds from now when the sync should start
See Also:
IPeopleService.startBackgroundContactSync(long)

pingUserActivity

public void pingUserActivity()
Description copied from interface: IPeopleService
Pings the service about user activity.

Specified by:
pingUserActivity in interface IPeopleService
See Also:
IPeopleService.pingUserActivity()

validateIdentityCredentials

public void validateIdentityCredentials(boolean dryRun,
                                        java.lang.String network,
                                        java.lang.String username,
                                        java.lang.String password,
                                        Bundle identityCapabilityStatus)
Description copied from interface: IPeopleService
Validate the given Social Network identity

Specified by:
validateIdentityCredentials in interface IPeopleService
Parameters:
dryRun - Set to true to validate credentials without actually signing the server up.
network - Social Network Name
username - Login user name
password - Login password
identityCapabilityStatus - Social Network capability status Bundle
See Also:
IPeopleService.validateIdentityCredentials(boolean, String, String, String, Bundle)

startStatusesSync

public void startStatusesSync()
Description copied from interface: IPeopleService
Push the ActivitiesEngine Engine to begin synchronising Activities

Specified by:
startStatusesSync in interface IPeopleService
See Also:
IPeopleService.startStatusesSync()

getNetworkAgentState

public NetworkAgentState getNetworkAgentState()
Description copied from interface: IPeopleService
Returns the current state of the Network Agent. Used for testing only.

Specified by:
getNetworkAgentState in interface IPeopleService
See Also:
IPeopleService.getNetworkAgentState()

setNetworkAgentState

public void setNetworkAgentState(NetworkAgentState state)
Description copied from interface: IPeopleService
Overrides the current state of the Network Agent. Used for testing only.

Specified by:
setNetworkAgentState in interface IPeopleService
Parameters:
state - A new overriding state.
See Also:
com.vodafone360.people.service.interfaces.IPeopleService#setNetowrkAgentState(NetworkAgentState)

getPresenceList

public void getPresenceList(long contactId)
Description copied from interface: IPeopleService
Request a refresh of the currently known Presence information (used for testing only)

Specified by:
getPresenceList in interface IPeopleService
Parameters:
contactId - Provide a contactId to receive detailed presence information for the given contact only
See Also:
IPeopleService.getPresenceList(long)

setAvailability

public void setAvailability(java.util.Hashtable<java.lang.String,java.lang.String> myself)
Description copied from interface: IPeopleService
Alter the current Social Network availability state and send it to the server.

Specified by:
setAvailability in interface IPeopleService
Parameters:
myself - is the wrapper for the own presence state, can be retrieved from PresenceTable.getUserByLocalContactId(long meProfileLocalContactId).
See Also:
IPeopleService.setAvailability(Hashtable)

subscribe

public void subscribe(Handler handler,
                      java.lang.Long contactId,
                      boolean chat)
Description copied from interface: IPeopleService
Allows an Activity to indicate to the Service that it is ready and able to handle incoming unsolicited UI events. This should be called in an Activities onResume() method, to indicate that the activity is currently on screen.

Specified by:
subscribe in interface IPeopleService
Parameters:
handler - to accept incoming unsolicited UI events from the Service.
contactId - Provide a contactId to receive updates for the given contact only. Set this to -1 to receive updates for every contact. Set this to NULL not to receive contact updates.
chat - - TRUE if the Handler expects chat messages.
See Also:
com.vodafone360.people.service.interfaces.IPeopleService#subscribe(Handler, long, boolean)

unsubscribe

public void unsubscribe(Handler handler)
Description copied from interface: IPeopleService
Allows the Activity to indicate that it is no longer in the foreground and will not handle incoming UI events correctly. This should be called in an Activities onPause() method, to indicate that the Activity is not on screen.

Specified by:
unsubscribe in interface IPeopleService
Parameters:
handler - that should no longer receive incoming unsolicited UI events from the Service
See Also:
IPeopleService.unsubscribe(Handler)

getUiAgent

public UiAgent getUiAgent()
Description copied from interface: BaseEngine.IEngineEventCallback
Returns the UiAgent, for sending unsolicited messages to the UI.

Specified by:
getUiAgent in interface BaseEngine.IEngineEventCallback
Returns:
UiAgent object.
See Also:
BaseEngine.IEngineEventCallback.getUiAgent()

getApplicationCache

public ApplicationCache getApplicationCache()
Description copied from interface: BaseEngine.IEngineEventCallback
Returns the ApplicationCache, for storing data.

Specified by:
getApplicationCache in interface BaseEngine.IEngineEventCallback
Returns:
Application cache object.
See Also:
BaseEngine.IEngineEventCallback.getApplicationCache()

sendMessage

public void sendMessage(long localContactId,
                        java.lang.String body,
                        int networkId)
Description copied from interface: IPeopleService
This method should be used to send a message to a contact

Specified by:
sendMessage in interface IPeopleService
body - Message text
See Also:
IPeopleService.sendMessage(long, String, int)

setIdentityStatus

public void setIdentityStatus(java.lang.String network,
                              java.lang.String identityId,
                              boolean identityStatus)
Description copied from interface: IPeopleService
Calls the set identity capability status API

Specified by:
setIdentityStatus in interface IPeopleService
Parameters:
network - Social Network Name
identityId - Social Network Identifier

getStatuses

public void getStatuses()
Description copied from interface: IPeopleService
This method should be called to retrieve status updates in StatusListActivity, @see ActivitiesEngine.

Specified by:
getStatuses in interface IPeopleService

getMoreTimelines

public void getMoreTimelines()
Description copied from interface: IPeopleService
This method should be called to retrieve older timelines in TimelineListActivity, @see ActivitiesEngine.

Specified by:
getMoreTimelines in interface IPeopleService

getOlderStatuses

public void getOlderStatuses()
Description copied from interface: IPeopleService
This method should be called to retrieve older statuses in StatusListActivity, @see ActivitiesEngine.

Specified by:
getOlderStatuses in interface IPeopleService

uploadMeProfile

public void uploadMeProfile()
Description copied from interface: IPeopleService
This method triggers the Me Profile upload

Specified by:
uploadMeProfile in interface IPeopleService

uploadMyStatus

public void uploadMyStatus(java.lang.String statusText)
Description copied from interface: IPeopleService
This method triggers the Me Profile status text upload

Specified by:
uploadMyStatus in interface IPeopleService
Parameters:
statusText - String - new Me Profile status text

downloadMeProfileFirstTime

public void downloadMeProfileFirstTime()
Description copied from interface: IPeopleService
This method triggers the Me Profile download, is currently called by UI

Specified by:
downloadMeProfileFirstTime in interface IPeopleService

updateChatNotification

public void updateChatNotification(long localContactId)
Description copied from interface: IPeopleService
This method should be called to update the Chat Notifications.

Specified by:
updateChatNotification in interface IPeopleService


JavaDoc