Package fi.moprim.tmd.sdk.model
Class TmdUploadMetadata
- java.lang.Object
-
- fi.moprim.tmd.sdk.model.TmdUploadMetadata
-
- All Implemented Interfaces:
android.os.Parcelable
public class TmdUploadMetadata extends java.lang.Object implements android.os.Parcelable
A class that summarizes the results of an upload
-
-
Field Summary
Fields Modifier and Type Field Description static android.os.Parcelable.Creator<TmdUploadMetadata>
CREATOR
-
Constructor Summary
Constructors Constructor Description TmdUploadMetadata()
Default constructor when nothing was setTmdUploadMetadata(long uploadTimestamp, int nbTmdActivities, long lastTmdActivityTimestamp, int nbLocations, long lastLocationTimestamp)
Default constructorTmdUploadMetadata(android.os.Parcel in)
Parcel constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
dataWasUploaded()
Check if some data (TMD or Location) was uploadedint
describeContents()
static Result<TmdUploadMetadata>
extractResult(android.content.Intent intent)
Extract the result embedded in the intentlong
getLastTimestampOfLocationUploaded()
Get the timestamp of the last location point that was just uploadedlong
getLastTimestampOfTmdActivityUploaded()
Get the end timestamp of last activity that was just uploadedint
getNbLocationsUploaded()
Get the number of location data points that were uploadedint
getNbTmdActivitiesUploaded()
Get the number of tmd activities that were just uploadedlong
getUploadTimestamp()
Get the upload timestamp of the last uploadstatic boolean
hasResult(android.content.Intent intent)
Check from an intent if it includes TMD_UPLOAD_METADATAjava.lang.String
toString()
void
writeToParcel(android.os.Parcel dest, int flags)
-
-
-
Field Detail
-
CREATOR
public static final android.os.Parcelable.Creator<TmdUploadMetadata> CREATOR
-
-
Constructor Detail
-
TmdUploadMetadata
public TmdUploadMetadata(long uploadTimestamp, int nbTmdActivities, long lastTmdActivityTimestamp, int nbLocations, long lastLocationTimestamp)
Default constructor- Parameters:
uploadTimestamp
- The upload timestamp of the last uploadnbTmdActivities
- The number of tmd activities that were just uploadedlastTmdActivityTimestamp
- The end timestamp of last activity that was just uploadednbLocations
- The number of location data points that were uploadedlastLocationTimestamp
- The timestamp of the last location point that was just uploaded
-
TmdUploadMetadata
public TmdUploadMetadata()
Default constructor when nothing was set
-
TmdUploadMetadata
public TmdUploadMetadata(android.os.Parcel in)
Parcel constructor- Parameters:
in
- the parcel
-
-
Method Detail
-
getUploadTimestamp
public long getUploadTimestamp()
Get the upload timestamp of the last upload- Returns:
- the upload timestamp of the last upload (usually the output of
System.currentTimeMillis()
)
-
getNbTmdActivitiesUploaded
public int getNbTmdActivitiesUploaded()
Get the number of tmd activities that were just uploaded- Returns:
- the number of tmd activities that were just uploaded
-
getLastTimestampOfTmdActivityUploaded
public long getLastTimestampOfTmdActivityUploaded()
Get the end timestamp of last activity that was just uploaded- Returns:
- the end timestamp of last activity that was just uploaded
-
getNbLocationsUploaded
public int getNbLocationsUploaded()
Get the number of location data points that were uploaded- Returns:
- the number of location data points that were uploaded
-
getLastTimestampOfLocationUploaded
public long getLastTimestampOfLocationUploaded()
Get the timestamp of the last location point that was just uploaded- Returns:
- the timestamp of the last location point that was just uploaded
-
dataWasUploaded
public boolean dataWasUploaded()
Check if some data (TMD or Location) was uploaded- Returns:
- true if getNbLocationsUploaded() + getNbTmdActivitiesUploaded() > 0
-
describeContents
public int describeContents()
- Specified by:
describeContents
in interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags)
- Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hasResult
public static boolean hasResult(android.content.Intent intent)
Check from an intent if it includes TMD_UPLOAD_METADATA- Parameters:
intent
- the intent to check- Returns:
- true if it embed a TmdUpdateMetadata result
-
extractResult
public static Result<TmdUploadMetadata> extractResult(android.content.Intent intent)
Extract the result embedded in the intent- Parameters:
intent
- the intent- Returns:
- the result that was extracted from the intent extras
-
-