public class MetadataTemplate extends BoxJSONObject
| Modifier and Type | Class and Description |
|---|---|
static class |
MetadataTemplate.Field
Class contains information about the metadata template field.
|
static class |
MetadataTemplate.FieldOperation
Posssible operations that can be performed in a Metadata template.
|
static class |
MetadataTemplate.Operation
Possible template operations.
|
static class |
MetadataTemplate.Option
Class contains information about the metadata template option.
|
| Modifier and Type | Field and Description |
|---|---|
static URLTemplate |
ENTERPRISE_METADATA_URL_TEMPLATE |
static URLTemplate |
METADATA_TEMPLATE_BY_ID_URL_TEMPLATE |
static URLTemplate |
METADATA_TEMPLATE_SCHEMA_URL_TEMPLATE |
static URLTemplate |
METADATA_TEMPLATE_URL_TEMPLATE |
| Constructor and Description |
|---|
MetadataTemplate()
Constructs an empty metadata template.
|
MetadataTemplate(String json)
Constructs a metadata template from a JSON string.
|
| Modifier and Type | Method and Description |
|---|---|
static MetadataTemplate |
createMetadataTemplate(BoxAPIConnection api,
String scope,
String templateKey,
String displayName,
boolean hidden,
List<MetadataTemplate.Field> fields)
Creates new metadata template.
|
static void |
deleteMetadataTemplate(BoxAPIConnection api,
String scope,
String template)
Deletes the schema of an existing metadata template.
|
static BoxResourceIterable<BoxMetadataQueryItem> |
executeMetadataQuery(BoxAPIConnection api,
String from,
String ancestorFolderId)
Executes a metadata query.
|
static BoxResourceIterable<BoxMetadataQueryItem> |
executeMetadataQuery(BoxAPIConnection api,
String from,
String query,
JsonObject queryParameters,
String ancestorFolderId)
Executes a metadata query.
|
static BoxResourceIterable<BoxMetadataQueryItem> |
executeMetadataQuery(BoxAPIConnection api,
String from,
String query,
JsonObject queryParameters,
String ancestorFolderId,
String indexName,
JsonArray orderBy)
Executes a metadata query.
|
static BoxResourceIterable<BoxMetadataQueryItem> |
executeMetadataQuery(BoxAPIConnection api,
String from,
String query,
JsonObject queryParameters,
String ancestorFolderId,
String indexName,
JsonArray orderBy,
int limit,
String marker)
Executes a metadata query.
|
String |
getDisplayName()
Gets the displayed metadata template name.
|
static Iterable<MetadataTemplate> |
getEnterpriseMetadataTemplates(BoxAPIConnection api,
String... fields)
Returns all metadata templates within a user's enterprise.
|
static Iterable<MetadataTemplate> |
getEnterpriseMetadataTemplates(String scope,
BoxAPIConnection api,
String... fields)
Returns all metadata templates within a user's scope.
|
static Iterable<MetadataTemplate> |
getEnterpriseMetadataTemplates(String scope,
int limit,
BoxAPIConnection api,
String... fields)
Returns all metadata templates within a user's scope.
|
List<MetadataTemplate.Field> |
getFields()
Gets the iterable with all fields the metadata template contains.
|
String |
getID()
Gets the ID of the template.
|
Boolean |
getIsHidden()
Gets is the metadata template hidden.
|
static MetadataTemplate |
getMetadataTemplate(BoxAPIConnection api)
Gets the metadata template of properties.
|
static MetadataTemplate |
getMetadataTemplate(BoxAPIConnection api,
String templateName)
Gets the metadata template of specified template type.
|
static MetadataTemplate |
getMetadataTemplate(BoxAPIConnection api,
String templateName,
String scope,
String... fields)
Gets the metadata template of specified template type.
|
static MetadataTemplate |
getMetadataTemplateByID(BoxAPIConnection api,
String templateID)
Geta the specified metadata template by its ID.
|
String |
getScope()
Gets the metadata template scope.
|
String |
getTemplateKey()
Gets the unique template key to identify the metadata template.
|
static MetadataTemplate |
updateMetadataTemplate(BoxAPIConnection api,
String scope,
String template,
List<MetadataTemplate.FieldOperation> fieldOperations)
Updates the schema of an existing metadata template.
|
clearPendingChanges, getPendingChanges, getPendingChangesAsJsonObjectpublic static final URLTemplate METADATA_TEMPLATE_URL_TEMPLATE
getMetadataTemplate(BoxAPIConnection)public static final URLTemplate METADATA_TEMPLATE_BY_ID_URL_TEMPLATE
public static final URLTemplate METADATA_TEMPLATE_SCHEMA_URL_TEMPLATE
public static final URLTemplate ENTERPRISE_METADATA_URL_TEMPLATE
public MetadataTemplate()
public MetadataTemplate(String json)
json - the json encoded metadate template.public String getTemplateKey()
public String getScope()
public String getDisplayName()
public Boolean getIsHidden()
public List<MetadataTemplate.Field> getFields()
public static MetadataTemplate createMetadataTemplate(BoxAPIConnection api, String scope, String templateKey, String displayName, boolean hidden, List<MetadataTemplate.Field> fields)
api - the API connection to be used.scope - the scope of the object.templateKey - a unique identifier for the template.displayName - the display name of the field.hidden - whether this template is hidden in the UI.fields - the ordered set of fields for the templatepublic static MetadataTemplate updateMetadataTemplate(BoxAPIConnection api, String scope, String template, List<MetadataTemplate.FieldOperation> fieldOperations)
api - the API connection to be usedscope - the scope of the objecttemplate - Unique identifier of the templatefieldOperations - the fields that needs to be updated / added in the templatepublic static void deleteMetadataTemplate(BoxAPIConnection api, String scope, String template)
api - the API connection to be usedscope - the scope of the objecttemplate - Unique identifier of the templatepublic static BoxResourceIterable<BoxMetadataQueryItem> executeMetadataQuery(BoxAPIConnection api, String from, String ancestorFolderId)
api - The API connection to be usedfrom - The template used in the query. Must be in the form scope.templateKeyancestorFolderId - The folder_id to which to restrain the querypublic static BoxResourceIterable<BoxMetadataQueryItem> executeMetadataQuery(BoxAPIConnection api, String from, String query, JsonObject queryParameters, String ancestorFolderId)
api - The API connection to be usedfrom - The template used in the query. Must be in the form scope.templateKeyquery - The logical expression of the queryqueryParameters - Required if query present. The arguments for the queryancestorFolderId - The folder_id to which to restrain the querypublic static BoxResourceIterable<BoxMetadataQueryItem> executeMetadataQuery(BoxAPIConnection api, String from, String query, JsonObject queryParameters, String ancestorFolderId, String indexName, JsonArray orderBy)
api - The API connection to be usedfrom - The template used in the query. Must be in the form scope.templateKeyquery - The logical expression of the queryqueryParameters - Required if query present. The arguments for the queryancestorFolderId - The folder_id to which to restrain the queryindexName - The name of the Index to useorderBy - The field_key(s) to order on and the corresponding direction(s)public static BoxResourceIterable<BoxMetadataQueryItem> executeMetadataQuery(BoxAPIConnection api, String from, String query, JsonObject queryParameters, String ancestorFolderId, String indexName, JsonArray orderBy, int limit, String marker)
api - The API connection to be usedfrom - The template used in the query. Must be in the form scope.templateKeyquery - The logical expression of the queryqueryParameters - Required if query present. The arguments for the queryancestorFolderId - The folder_id to which to restrain the queryindexName - The name of the Index to useorderBy - The field_key(s) to order on and the corresponding direction(s)limit - Max results to return for a single request (0-100 inclusive)marker - The marker to use for requesting the next pagepublic static MetadataTemplate getMetadataTemplate(BoxAPIConnection api)
api - the API connection to be used.public static MetadataTemplate getMetadataTemplate(BoxAPIConnection api, String templateName)
api - the API connection to be used.templateName - the metadata template type name.public static MetadataTemplate getMetadataTemplate(BoxAPIConnection api, String templateName, String scope, String... fields)
api - the API connection to be used.templateName - the metadata template type name.scope - the metadata template scope (global or enterprise).fields - the fields to retrieve.public static MetadataTemplate getMetadataTemplateByID(BoxAPIConnection api, String templateID)
api - the API connection to be used.templateID - the ID of the template to get.public static Iterable<MetadataTemplate> getEnterpriseMetadataTemplates(BoxAPIConnection api, String... fields)
api - the API connection to be used.fields - the fields to retrieve.public static Iterable<MetadataTemplate> getEnterpriseMetadataTemplates(String scope, BoxAPIConnection api, String... fields)
scope - the scope of the metadata templates.api - the API connection to be used.fields - the fields to retrieve.public static Iterable<MetadataTemplate> getEnterpriseMetadataTemplates(String scope, int limit, BoxAPIConnection api, String... fields)
scope - the scope of the metadata templates.limit - maximum number of entries per response.api - the API connection to be used.fields - the fields to retrieve.