public abstract class OneItem
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected de.tuberlin.onedrivesdk.common.ConcreteOneDriveSDK |
api
The SDK object.
|
protected java.util.HashMap<java.lang.String,DriveUser> |
createdBy
The created by reference.
|
protected java.lang.String |
createdDateTime
The creation timestamp of this item.
|
protected java.lang.String |
cTag
The cTag.
|
protected java.lang.String |
downloadUrl
A Url that can be used to download this file's content.
|
protected java.lang.String |
eTag
The eTag.
|
protected java.lang.String |
id
The OneDrive id of the resource.
|
protected java.util.HashMap<java.lang.String,DriveUser> |
lastModifiedBy
The modified by reference.
|
protected java.lang.String |
lastModifiedDateTime
The last modified timestamp of this item.
|
protected java.lang.String |
name
The Name.
|
protected ParentReference |
parentReference
The parent folder reference.
|
protected java.lang.String |
rawJson
The raw JSON which is received from the OneDrive API.
|
protected long |
size
The size of an item in bytes.
|
protected java.lang.String |
webUrl
URL that displays the resource in the browser.
|
Constructor and Description |
---|
OneItem() |
Modifier and Type | Method and Description |
---|---|
boolean |
delete()
Delete the item.
|
static OneItem |
fromJSON(java.lang.String json)
Parse a OneItem object from JSON.
|
java.util.HashMap<java.lang.String,DriveUser> |
getCreatedBy()
The created by reference.
|
long |
getCreatedDateTime()
The creation timestamp of this item.
|
java.lang.String |
getCTag()
Gets the cTag.
|
java.lang.String |
getETag()
Gets the eTag.
|
java.lang.String |
getId()
Gets the id of the item.
|
java.util.HashMap<java.lang.String,DriveUser> |
getLastModifiedBy()
The modified by reference.
|
long |
getLastModifiedDateTime()
The last modified timestamp of this item.
|
long |
getLastRefresh()
Gets the timestamp of the last refresh.
|
java.lang.String |
getName()
Gets the name of the item.
|
OneFolder |
getParentFolder()
Gets the parent folder.
|
java.lang.String |
getRawJson()
Gets the raw JSON which is received from the OneDrive API.
|
long |
getSize()
Gets the size of this item in bytes.
|
java.lang.String |
getWebUrl()
Gets the URL that displays the resource in the browser.
|
abstract boolean |
isFile()
Is file.
|
abstract boolean |
isFolder()
Is folder.
|
static java.util.List<OneItem> |
parseItemsFromJson(java.lang.String json)
Parse a List of OneItems from JSON.
|
static java.util.List<OneItem> |
parseItemsFromJson(java.lang.String json,
OneItemType type)
Parse a List of OneItems from JSON.
|
OneItem |
refreshItem()
Refresh the item state.
|
OneItem |
setApi(de.tuberlin.onedrivesdk.common.ConcreteOneDriveSDK api)
Sets the api object.
|
OneItem |
setLastRefresh(long lastRefresh)
Sets the timestamp of the last refresh.
|
OneItem |
setRawJson(java.lang.String rawJson)
Sets the raw json.
|
protected de.tuberlin.onedrivesdk.common.ConcreteOneDriveSDK api
protected java.lang.String id
protected java.lang.String name
protected java.util.HashMap<java.lang.String,DriveUser> createdBy
protected java.lang.String createdDateTime
protected java.util.HashMap<java.lang.String,DriveUser> lastModifiedBy
protected java.lang.String lastModifiedDateTime
protected java.lang.String cTag
protected java.lang.String eTag
protected long size
protected java.lang.String webUrl
protected ParentReference parentReference
protected java.lang.String rawJson
protected java.lang.String downloadUrl
public static OneItem fromJSON(java.lang.String json) throws org.json.simple.parser.ParseException, OneDriveException
json
- JSON from the OneDrive APIorg.json.simple.parser.ParseException
- if the JSON can not be parsedOneDriveException
- if the JSON contains an OneDrive Error object from the APIpublic static java.util.List<OneItem> parseItemsFromJson(java.lang.String json) throws org.json.simple.parser.ParseException, OneDriveException
json
- JSON from the OneDrive APIorg.json.simple.parser.ParseException
- if the JSON can not be parsedOneDriveException
- if the JSON contains an OneDrive Error object from the APIpublic static java.util.List<OneItem> parseItemsFromJson(java.lang.String json, OneItemType type) throws org.json.simple.parser.ParseException, OneDriveException
json
- JSON from the OneDrive APItype
- OneItemType, can be used to define which type of items should be parsedorg.json.simple.parser.ParseException
- if the JSON can not be parsedOneDriveException
- if the json dose not contain a 'value' attributepublic java.lang.String getName()
public OneItem setApi(de.tuberlin.onedrivesdk.common.ConcreteOneDriveSDK api) throws OneDriveException
api
- the api objectOneDriveException
- if the api is nullpublic java.lang.String getId()
public boolean delete() throws java.io.IOException, OneDriveException
java.io.IOException
OneDriveException
public java.lang.String getCTag()
public java.lang.String getETag()
public java.util.HashMap<java.lang.String,DriveUser> getCreatedBy()
public long getCreatedDateTime()
public java.util.HashMap<java.lang.String,DriveUser> getLastModifiedBy()
public long getLastModifiedDateTime()
public long getSize()
public java.lang.String getWebUrl()
public OneFolder getParentFolder() throws java.io.IOException, OneDriveException
java.io.IOException
OneDriveException
public java.lang.String getRawJson()
public OneItem setRawJson(java.lang.String rawJson)
rawJson
- jsonpublic long getLastRefresh()
public OneItem setLastRefresh(long lastRefresh)
lastRefresh
- timestamp in millisecondspublic OneItem refreshItem() throws java.io.IOException, OneDriveException
java.io.IOException
OneDriveException
public abstract boolean isFile()
public abstract boolean isFolder()