Skip to main content

Box

The box module lets editors search and import files from a linked Box account through Brightspot's federated search.

Dependencies

Depends on db-http and the Box Java SDK (com.box.sdk), which wraps the Box Content API and its OAuth2 authorization flow.

Installation

<!-- Requires Brightspot 5.0 or later. -->
<dependency>
<groupId>com.brightspot.dbhttp</groupId>
<artifactId>box</artifactId>
<version>1.0.0</version>
</dependency>

API reference

com.psddev.box.BoxDatabase

Extends HttpDatabase. Searches files (type=file) in the editor's linked Box account and passes offset/limit straight through to Box's native pagination.

com.psddev.box.FederatedBoxFile

Extends ExternalItem, displayed as Box File.

FieldTypeDescription
boxIdStringThe Box file Id.
nameStringThe file name.
createdAtDateWhen the file was created in Box.
modifiedAtDateWhen the file was last modified in Box.
descriptionStringThe Box file description.
sizeStringThe file size, formatted as a human-readable string.
createdByStringWho created the file in Box.
modifiedByStringWho last modified the file in Box.
trashedAtDateWhen the file was trashed in Box, if applicable.
ownedByStringThe Box account that owns the file.
sharedLinkStringThe file's Box shared link, if one exists.
tagsList<String>Tags applied to the file in Box.
parentFolderStringThe name of the file's parent folder in Box.

createdBy, modifiedBy, sharedLink, tags, and parentFolder are only populated when an editor opens a file's detail view — search results include only the fields Box returns from its search endpoint.

Configuration

The OAuth2 application key and secret are stored on BoxSettings, a Modification<CmsTool> shown under Site Settings > Integrations > Box. BoxDatabaseProvider throws an exception if these aren't set. Each editor additionally links their own Box account (BoxAccountAccess), surfaced under the editor's user settings, before they can search Box.

Extending the plugin

The module doesn't ship a content type for imported files. To let editors create one from search results, define a content type and extend ExternalItemConverter<FederatedBoxFile, T> to convert the external item into it on import, downloading the file's content through the Box API.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.