public class MetaDataRequest extends VaultRequest<MetaDataRequest>
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_REFERENCE_ID, HTTP_HEADER_VAULT_CLIENT_ID, referenceId, vaultClient| Modifier and Type | Method and Description |
|---|---|
VaultResponse |
cancelRawObjectDeployment(String objectName)
Cancel Raw Object Deployment
|
VaultResponse |
executeMDLScript()
Execute MDL Script
|
JobCreateResponse |
executeMDLScriptAsynchronously()
Execute MDL Script Asynchronously
|
MetaDataComponentTypeBulkResponse |
retrieveAllComponentMetadata()
Retrieve All Component Metadata
|
MdlResponse |
retrieveAsynchronousMDLScriptResults(String jobId)
Retrieve Asynchronous MDL Script Results
|
MdlResponse |
retrieveComponentRecordMdl(String componentType,
String recordName)
Retrieve Component Record MDL
|
MetaDataComponentTypeBulkResponse |
retrieveComponentRecords(String component)
Retrieve Component Record Collection
|
MetaDataComponentRecordResponse |
retrieveComponentRecordXmlJson(String componentType,
String recordName)
Retrieve Component Record XML/JSON
|
MetaDataComponentTypeResponse |
retrieveComponentTypeMetadata(String component)
Retrieve Component Type Metadata
|
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
|
MetaDataObjectPageLayoutResponse |
retrievePageLayoutMetadata(String objectName,
String layoutName)
Retrieve Page Layout Metadata
|
MetaDataObjectPageLayoutResponse |
retrievePageLayouts(String objectName)
Retrieve Page Layouts
|
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, setHeaderReferenceId, 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 MdlResponse retrieveAsynchronousMDLScriptResults(String jobId)
After submitting a request to deploy an MDL script asynchronously, you can query Vault to determine the results of the request.
jobId - id of the job executing the MDL scriptGET /api/mdl/execute_async/{job_id}/results
MdlResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.getAsynchronousMDLJobResults(jobId);System.out.println(resp.getResponseStatus());
public VaultResponse cancelRawObjectDeployment(String objectName)
Cancel a deployment of configuration changes to a high volume object. To use this endpoint, your object's configuration_state must be IN_DEPLOYMENT.
objectName - of the object being converted to a raw object
GET /api/metadata/vobjects/{object_name}/actions/canceldeployment
MdlResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.cancelRawObjectDeployment(objectName);System.out.println(resp.getResponseStatus());
public MetaDataComponentTypeBulkResponse retrieveAllComponentMetadata()
Retrieve metadata of all component types in your Vault.
GET /api/{version}/metadata/components
MetaDataComponentTypeBulkResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrieveAllComponentMetadata();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);VaultObject 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);VaultObjectField 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 MetaDataObjectPageLayoutResponse retrievePageLayouts(String objectName)
Given an object, retrieve all page layouts associated with that object.
objectName - Vault object name
GET /api/{version}/metadata/vobjects/{object_name}/page_layouts
MetaDataObjectPageLayoutResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrievePageLayouts("user__sys");
if (resp.isSuccessful()) {
System.out.println(resp.getData().get(0).getName());
}public MetaDataObjectPageLayoutResponse retrievePageLayoutMetadata(String objectName, String layoutName)
Given a page layout name, retrieve the metadata for that specific page layout.
objectName - Vault object namelayoutName - Vault page layout name
GET /api/{version}/metadata/vobjects/{object_name}/page_layouts/{layout_name}
MetaDataObjectPageLayoutResponse resp = vaultClient.newRequest(MetaDataRequest.class)
.retrievePageLayoutMetadata("user__sys", "user_detail_page_layout__c");
System.out.println(resp.getResponseStatus());
public 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 © 2024. All rights reserved.