public class MetaDataRequest extends VaultRequest
Coverage for all endpoints containing:
MetaData endpoints include all components and object specific components that reside in the Object section of the API documentation. The response formats vary for each meta-data components properties (there are over 35 metadata components). Common/Shared properties are included in the response. Additional properties are parsed in developers reading of JSON/POJO properties.
HTTP_HEADER_AUTHORIZATION, HTTP_HEADER_VAULT_CLIENT_ID, vaultClient| Modifier and Type | Method and Description |
|---|---|
VaultResponse |
executeMDLScript()
Execute MDL Script
|
JobCreateResponse |
executeMDLScriptAsynchronously()
Execute MDL Script Asynchronously
|
MdlResponse |
retrieveComponentRecordMdl(String componentType,
String recordName)
Retrieve Component Record MDL
|
MetaDataComponentTypeBulkResponse |
retrieveComponentRecords(String component)
Retrieve Component Type Metadata
|
MetaDataComponentRecordResponse |
retrieveComponentRecordXmlJson(String componentType,
String recordName)
Retrieve Component Record XML/JSON
|
MetaDataComponentTypeResponse |
retrieveComponentTypeMetadata(String component)
Retrieve Component Type Metadata
|
MetaDataComponentTypeBulkResponse |
retrieveComponentTypes()
Retrieve Component Types
|
ComponentContentResponse |
retrieveContentFile(String componentType,
String recordName)
Retrieve Content File
|
MetaDataObjectBulkResponse |
retrieveObjectCollection()
Retrieve Object Collection
|
MetaDataObjectFieldResponse |
retrieveObjectFieldMetaData(String objectName,
String fieldName)
Retrieve Object Field Metadata
|
MetaDataObjectResponse |
retrieveObjectMetadata(String objectName)
Retrieve Object Metadata
|
MetaDataRequest |
setAcceptJSON()
Set the Header Accept to return CSV
|
MetaDataRequest |
setBinaryFile(String filename,
byte[] binaryContent)
Specify source data in an input file
|
MetaDataRequest |
setInputPath(String inputPath)
Specify source data in an input file
|
MetaDataRequest |
setLocalized(Boolean localized)
Set to true to retrieve localized (translated) strings for the
label, label_plural, and help_content object fields.
|
MetaDataRequest |
setRequestString(String requestString)
Specify source data in an input string, such as a JSON request
|
ComponentContentResponse |
uploadContentFile()
Upload Content File
|
getBaseObjectMapper, send, send, sendReturnBinary, sendReturnBinary, sendToFile, sendToFile, setVaultClientpublic VaultResponse executeMDLScript()
This endpoint executes the given MDL script on a vault.
POST /api/mdl/execute
VaultResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.setRequestString(mdl)
.executeMDLScript();System.out.println(resp.getResponseStatus());
public JobCreateResponse executeMDLScriptAsynchronously()
This asynchronous endpoint executes the given MDL script on a vault.
While you can execute any MDL script asynchronously, this endpoint is required if you’re operating on 10,000+ high volume object records and executing one of the following operations:
Enabling lifecycles Enabling object types Adding or removing a field Updating the max length of a text field Adding or removing an Index Changing the fields that compose an Index
POST /api/mdl/execute_asyc
JobCreateResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.setRequestString(mdl)
.executeMDLScriptAsynchronously();System.out.println(resp.getResponseStatus());
public MetaDataComponentTypeBulkResponse retrieveComponentTypes()
Get a list of all metadata component types in the Vault
GET /api/{version}/metadata/components
MetaDataComponentTypeBulkResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrieveComponentTypes();for (ComponentType c : resp.getData()) System.out.println(c.getName() + " s" + c.getLabel());
public MetaDataComponentTypeResponse retrieveComponentTypeMetadata(String component)
Retrieve metadata of a specific component type.
component - to retrieve
GET /api/{version}/metadata/components/{component_type}
MetaDataComponentTypeResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrieveComponentTypeMetadata(componentName);
MetaDataComponent comp = resp.getData();
System.out.println("\nName = " + comp.getName());
System.out.println("Class = " + comp.getClassName());
System.out.println("Abbreviation = " + comp.getAbbreviation());
System.out.println("Active = " + comp.getActive());
System.out.println("\nAdditional Properties");
System.out.println("------------------------");
for (String s : comp.getProperties().keySet())
System.out.println(s + " = " + comp.getProperties().get(s));
System.out.println("\nAttributes");
System.out.println("------------------------");
for (Attribute attr : comp.getAttributes()) {
System.out.println(attr.getName() + " " + attr.getType());
for (String s : attr.getProperties().keySet())
System.out.println(s + " = " + attr.getProperties().get(s));
}
System.out.println("\nSubcomponents");
System.out.println("------------------------");
for (SubComponentType subcomp : comp.getSubComponents()) {
System.out.println("\n" + subcomp.getName());
System.out.println(" ");
for (Attribute attr : subcomp.getAttributes()) {
System.out.println(attr.getName() + " " + attr.getType());
for (String s : attr.getProperties().keySet())
System.out.println(s + " = " + attr.getProperties().get(s));
}
}public MetaDataObjectResponse retrieveObjectMetadata(String objectName)
Retrieve all metadata configured on a standard or custom Vault Object. Localized strings can be included via the "setLocalized" method in the builder.
objectName - Object name to retrieve
GET /api/{version}/metadata/vobjects/{object_name}
MetaDataObjectResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrieveObjectMetadata(objectName);Object objectMetaData = resp.getObject();
System.out.println("Name = " + objectMetaData.getName());
System.out.println("Help = " + objectMetaData.getHelpContent());
System.out.println("Label = " + objectMetaData.getLabel());
System.out.println("URL Field = " + objectMetaData.getUrls().getField());
System.out.println("URL Record = " + objectMetaData.getUrls().getRecord());
System.out.println("URL List = " + objectMetaData.getUrls().getList());
System.out.println("UserRoleSetupObject = " + objectMetaData.getUserRoleSetupObject());
if (objectMetaData.getAvailableLifecycles() != null) {
for (String s : objectMetaData.getAvailableLifecycles())
System.out.println("Lifecycle = " + s);
}
if (objectMetaData.getRelationships() != null) {
for (Object.Relationship relationship : objectMetaData.getRelationships())
System.out.println("Relationship = " + relationship.getRelationshipName() + " " + relationship.getField() + " " + relationship.getObjectReference().getName());
}
if (objectMetaData.getUserRoleSetupObject() != null) {
System.out.println("UserRoleSetupObject URL " + objectMetaData.getUserRoleSetupObject().getUrl());
System.out.println("UserRoleSetupObject Name " + objectMetaData.getUserRoleSetupObject().getName());
System.out.println("UserRoleSetupObject Label " + objectMetaData.getUserRoleSetupObject().getLabel());
}public MetaDataObjectFieldResponse retrieveObjectFieldMetaData(String objectName, String fieldName)
Localized strings can be included via the "setLocalized" method in the builder
objectName - Object name to retrievefieldName - Field name to retrieve
GET /api/{version}/metadata/vobjects/{object_name}/fields/{object_field_name}
MetaDataObjectFieldResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrieveObjectFieldMetaData(objectName, fieldName);ObjectField fieldMetaData = resp.getField();
System.out.println("Name = " + fieldMetaData.getName());
System.out.println("Label = " + fieldMetaData.getLabel());
System.out.println("Required = " + fieldMetaData.getRequired());
System.out.println("Help = " + fieldMetaData.getHelpContent());
System.out.println("Relationship Name = " + fieldMetaData.getLookupRelationshipName());
if (fieldMetaData.getObjectReference() != null) {
System.out.println("Object referencer URL " + fieldMetaData.getObjectReference().getUrl());
System.out.println("Object referencer Name " + fieldMetaData.getObjectReference().getName());
System.out.println("Object referencer Label " + fieldMetaData.getObjectReference().getLabel());
}public MetaDataObjectBulkResponse retrieveObjectCollection()
Localized strings can be included via the "setLocalized" method in the builder
GET /api/{version}/metadata/vobjectsMetaDataObjectBulkResponse resp = vaultClient.newRequest(MetaDataRequest.class).retrieveObjectCollection();
for (Object c : resp.getObjects()) {
System.out.println(c.getName() + " " + c.getLabel() + " " + c.getUrl());
}public MetaDataComponentTypeBulkResponse retrieveComponentRecords(String component)
Retrieve all records for a specific component type.
component - to retrieve
GET /api/{version}/configuration/{component_type}
MetaDataComponentTypeBulkResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrieveComponentRecords(componentType);
if (resp.isSuccessful()) {
for (ComponentType componentType : resp.getData()) {
System.out.println(component.getName());
}
}public MetaDataComponentRecordResponse retrieveComponentRecordXmlJson(String componentType, String recordName)
componentType - The component type name (Picklist, Docfield, Doctype, etc.)recordName - The name of the record to retrieve metadata
GET /api/{version}/configuration/{component_type}.{record_name}
MetaDataComponentRecordResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrieveComponentRecordXmlJson(componentType, recordName);
if (resp.isSuccessful()) {
System.out.println(resp.getData().getName());
}public MdlResponse retrieveComponentRecordMdl(String componentType, String recordName)
componentType - The component type name (Picklist, Docfield, Doctype, etc.)recordName - The name of the record to retrieve metadata
GET /api/mdl/components/{component_type}.{record_name}
MdlResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrieveComponentRecordMdl("Picklist","test__c");
if (resp.isSuccessful()) {
System.out.println(new String(resp.getBinaryContent()));
}public ComponentContentResponse uploadContentFile()
This endpoint allows you to upload a content file to be referenced by a component.
Once uploaded, Vault stores the file in a generic files staging area where they will remain until referenced by a component. Once referenced, Vault cannot access the named file from the staging area.
POST /api/mdl/files
public ComponentContentResponse retrieveContentFile(String componentType, String recordName)
componentType - vault component typerecordName - api name of component
GET /api/mdl/components/{component_type}.{record_name}/filespublic MetaDataRequest setAcceptJSON()
public MetaDataRequest setBinaryFile(String filename, byte[] binaryContent)
filename - file name (no path)binaryContent - byte array of the file contentpublic MetaDataRequest setLocalized(Boolean localized)
localized - True for localized stringspublic MetaDataRequest setInputPath(String inputPath)
inputPath - Absolute path to the file for the requestpublic MetaDataRequest setRequestString(String requestString)
requestString - The source request as a stringCopyright © 2021. All rights reserved.