public abstract class BoxItem extends BoxResource
Modifier and Type | Class and Description |
---|---|
class |
BoxItem.Info
Contains information about a BoxItem.
|
Modifier and Type | Field and Description |
---|---|
static String[] |
ALL_FIELDS
An array of all possible file fields that can be requested when calling
getInfo() . |
static URLTemplate |
SHARED_ITEM_URL_TEMPLATE
Shared Item URL Template.
|
static URLTemplate |
WATERMARK_URL_TEMPLATE
Url template for operations with watermarks.
|
Constructor and Description |
---|
BoxItem(BoxAPIConnection api,
String id)
Constructs a BoxItem for an item with a given ID.
|
Modifier and Type | Method and Description |
---|---|
protected BoxWatermark |
applyWatermark(URLTemplate itemUrl,
String imprint)
Used to apply or update the watermark for the item.
|
abstract BoxItem.Info |
copy(BoxFolder destination)
Copies this item to another folder.
|
abstract BoxItem.Info |
copy(BoxFolder destination,
String newName)
Copies this item to another folder and gives it a new name.
|
abstract BoxSharedLink |
createSharedLink(BoxSharedLink.Access access,
Date unshareDate,
BoxSharedLink.Permissions permissions)
Creates a new shared link for this item.
|
abstract BoxItem.Info |
getInfo()
Gets information about this item.
|
abstract BoxItem.Info |
getInfo(String... fields)
Gets information about this item that's limited to a list of specified fields.
|
protected URL |
getItemURL() |
static BoxItem.Info |
getSharedItem(BoxAPIConnection api,
String sharedLink)
Gets an item that was shared with a shared link.
|
static BoxItem.Info |
getSharedItem(BoxAPIConnection api,
String sharedLink,
String password)
Gets an item that was shared with a password-protected shared link.
|
protected BoxWatermark |
getWatermark(URLTemplate itemUrl,
String... fields)
Used to retrieve the watermark for the item.
|
abstract BoxItem.Info |
move(BoxFolder destination)
Moves this item to another folder.
|
abstract BoxItem.Info |
move(BoxFolder destination,
String newName)
Moves this item to another folder and gives it a new name.
|
protected void |
removeWatermark(URLTemplate itemUrl)
Removes a watermark from the item.
|
abstract BoxItem.Info |
setCollections(BoxCollection... collections)
Sets the collections that this item belongs to.
|
equals, getAPI, getID, getResourceType, hashCode
public static final String[] ALL_FIELDS
getInfo()
.public static final URLTemplate SHARED_ITEM_URL_TEMPLATE
public static final URLTemplate WATERMARK_URL_TEMPLATE
public BoxItem(BoxAPIConnection api, String id)
api
- the API connection to be used by the item.id
- the ID of the item.protected URL getItemURL()
public static BoxItem.Info getSharedItem(BoxAPIConnection api, String sharedLink)
api
- the API connection to be used by the shared item.sharedLink
- the shared link to the item.public static BoxItem.Info getSharedItem(BoxAPIConnection api, String sharedLink, String password)
api
- the API connection to be used by the shared item.sharedLink
- the shared link to the item.password
- the password for the shared link.protected BoxWatermark getWatermark(URLTemplate itemUrl, String... fields)
itemUrl
- url template for the item.fields
- the fields to retrieve.protected BoxWatermark applyWatermark(URLTemplate itemUrl, String imprint)
itemUrl
- url template for the item.imprint
- the value must be "default", as custom watermarks is not yet supported.protected void removeWatermark(URLTemplate itemUrl)
itemUrl
- url template for the item.public abstract BoxItem.Info copy(BoxFolder destination)
destination
- the destination folder.public abstract BoxItem.Info copy(BoxFolder destination, String newName)
destination
- the destination folder.newName
- a new name for the copied item.public abstract BoxItem.Info move(BoxFolder destination)
destination
- the destination folder.public abstract BoxItem.Info move(BoxFolder destination, String newName)
destination
- the destination folder.newName
- a new name for the moved item.public abstract BoxSharedLink createSharedLink(BoxSharedLink.Access access, Date unshareDate, BoxSharedLink.Permissions permissions)
This method is a convenience method for manually creating a new shared link and applying it to this item with
BoxItem.Info.setSharedLink(com.box.sdk.BoxSharedLink)
. You may want to create the shared link manually so that it can be updated along with
other changes to the item's info in a single network request, giving a boost to performance.
access
- the access level of the shared link.unshareDate
- the date and time at which the link will expire. Can be null to create a non-expiring link.permissions
- the permissions of the shared link. Can be null to use the default permissions.public abstract BoxItem.Info getInfo()
public abstract BoxItem.Info getInfo(String... fields)
fields
- the fields to retrieve.public abstract BoxItem.Info setCollections(BoxCollection... collections)
collections
- the collections that this item should belong to.