master ce6d6624d081 cached
73 files
946.0 KB
226.6k tokens
1 requests
Download .txt
Showing preview only (984K chars total). Download the full file or copy to clipboard to get everything.
Repository: forcedotcom/CustomMetadataLoader
Branch: master
Commit: ce6d6624d081
Files: 73
Total size: 946.0 KB

Directory structure:
gitextract_dcfiskbn/

├── CODEOWNERS
├── LICENSE.md
├── README.md
├── custom_md_loader/
│   ├── applications/
│   │   └── Custom_Metadata_Loader.app
│   ├── classes/
│   │   ├── AppConstants.cls
│   │   ├── AppConstants.cls-meta.xml
│   │   ├── CSVFileUtil.cls
│   │   ├── CSVFileUtil.cls-meta.xml
│   │   ├── CustomMetadataLoaderController.cls
│   │   ├── CustomMetadataLoaderController.cls-meta.xml
│   │   ├── CustomMetadataLoaderControllerTest.cls
│   │   ├── CustomMetadataLoaderControllerTest.cls-meta.xml
│   │   ├── CustomMetadataUploadController.cls
│   │   ├── CustomMetadataUploadController.cls-meta.xml
│   │   ├── CustomMetadataUploadControllerTest.cls
│   │   ├── CustomMetadataUploadControllerTest.cls-meta.xml
│   │   ├── JsonUtilities.cls
│   │   ├── JsonUtilities.cls-meta.xml
│   │   ├── MDWrapperWebServiceMock.cls
│   │   ├── MDWrapperWebServiceMock.cls-meta.xml
│   │   ├── MetadataApexApiLoader.cls
│   │   ├── MetadataApexApiLoader.cls-meta.xml
│   │   ├── MetadataLoader.cls
│   │   ├── MetadataLoader.cls-meta.xml
│   │   ├── MetadataLoaderClient.cls
│   │   ├── MetadataLoaderClient.cls-meta.xml
│   │   ├── MetadataLoaderFactory.cls
│   │   ├── MetadataLoaderFactory.cls-meta.xml
│   │   ├── MetadataMapper.cls
│   │   ├── MetadataMapper.cls-meta.xml
│   │   ├── MetadataMapperCustom.cls
│   │   ├── MetadataMapperCustom.cls-meta.xml
│   │   ├── MetadataMapperDefault.cls
│   │   ├── MetadataMapperDefault.cls-meta.xml
│   │   ├── MetadataMapperFactory.cls
│   │   ├── MetadataMapperFactory.cls-meta.xml
│   │   ├── MetadataMapperSimple.cls
│   │   ├── MetadataMapperSimple.cls-meta.xml
│   │   ├── MetadataMapperType.cls
│   │   ├── MetadataMapperType.cls-meta.xml
│   │   ├── MetadataMappingInfo.cls
│   │   ├── MetadataMappingInfo.cls-meta.xml
│   │   ├── MetadataMigrationController.cls
│   │   ├── MetadataMigrationController.cls-meta.xml
│   │   ├── MetadataMigrationException.cls
│   │   ├── MetadataMigrationException.cls-meta.xml
│   │   ├── MetadataObjectCreator.cls
│   │   ├── MetadataObjectCreator.cls-meta.xml
│   │   ├── MetadataOpType.cls
│   │   ├── MetadataOpType.cls-meta.xml
│   │   ├── MetadataResponse.cls
│   │   ├── MetadataResponse.cls-meta.xml
│   │   ├── MetadataService.cls
│   │   ├── MetadataService.cls-meta.xml
│   │   ├── MetadataServiceTest.cls
│   │   ├── MetadataServiceTest.cls-meta.xml
│   │   ├── MetadataUtil.cls
│   │   ├── MetadataUtil.cls-meta.xml
│   │   ├── MetadataWrapperApiLoader.cls
│   │   └── MetadataWrapperApiLoader.cls-meta.xml
│   ├── labels/
│   │   └── CustomLabels.labels
│   ├── objects/
│   │   └── CountryMapping__mdt.object
│   ├── package.xml
│   ├── pages/
│   │   ├── CMTMigrator.page
│   │   ├── CMTMigrator.page-meta.xml
│   │   ├── CustomMetadataLoader.page
│   │   ├── CustomMetadataLoader.page-meta.xml
│   │   ├── CustomMetadataRecordUploader.page
│   │   └── CustomMetadataRecordUploader.page-meta.xml
│   ├── permissionsets/
│   │   └── Custom_Metadata_Loader.permissionset
│   └── tabs/
│       ├── CMT_Migrator.tab
│       └── Custom_Metadata_Loader.tab
└── sample.csv

================================================
FILE CONTENTS
================================================

================================================
FILE: CODEOWNERS
================================================
# Comment line immediately above ownership line is reserved for related gus information. Please be careful while editing.
#ECCN:Open Source


================================================
FILE: LICENSE.md
================================================
Copyright (c) 2016, Salesforce.com, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the Salesforce.com, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Portions of this software are derived from works with the following license:

Copyright (c) 2013, Andrew Fawcett All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the Andrew Fawcett, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


================================================
FILE: README.md
================================================
# Using CLI Commands

Salesforce CLI commands for custom metadata types are available in v49. The custom metadata loader is no longer supported or maintained. As such, Salesforce does not guarantee the functionality or performance of the loader. 

The CLI commands simplify development and help you build automation and synchronize your source from scratch orgs when working with custom metadata types. CLI commands offer more functionality than the custom metadata loader. You can create custom metadata types, generate fields, create records, bulk insert records from a CSV file, and generate custom metadata types from an sObject. In addition, there's no limit on the number of records that can be loaded. 

See the following for more information:

* [Create and Manage Custom Metadata Types Using CLI](https://help.salesforce.com/articleView?id=custommetadatatypes_cli.htm)	
* [cmdt Commands](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_cmdt.htm#cli_reference_force_cmdt) 

# Custom Metadata Loader

<a href="https://githubsfdeploy.herokuapp.com">
   <img alt="Deploy to Salesforce"
		 src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png">
</a>

v 3.0
Custom Metadata tool now supports migration of Custom Settings or Custom Objects to Custom Metadata Types along with migration of records. If you already have Custom Metadata Type, then it can just migrate the Custom Settings/Custom Objects records.

v 2.0
The Custom Metadata loader tool now supports updates of existing custom metadata records. Load the csv file with updates to existing records, and use the tool the import and update the records.
# How to use custom metadata loader to update existing records

1. Please follow the instructions below to first load/create the records for the custom metadata type.
2. Now create a csv file with record values you want to update
2. Now select the CSV file and the corresponding custom metadata type.
5. Click 'Create/Update custom metadata' to bulk update the records from the CSV file into your org.


v 1.0
Custom metadata loader is a tool for creating custom metadata records from a csv file. Create custom metadata types in your Salesforce org using Metadata API and then use custom metadata loader to bulk load the records. Behind the scenes, custom metadata loader uses Metadata API to bulk load up to 200 records with a single call.

Custom metadata loader has a sample custom metadata type CountryMapping__mdt that allows users to map country codes to country names.

# How to deploy custom metadata loader
1. Download the folder custom_md_loader and zip all the files inside this folder. Package.xml should be at the top level of the zipped file.
2. Log in to your developer organization via workbench and deploy this zip file. (migration -> deploy)

# How to use custom metadata loader

1. Once you have deployed custom metadata loader in your org, assign the permission set 'Custom Metadata Loader' to the users who need to use the tool(See Step 2, 3 on how to assign the perm set)
   These users also need the 'Customize Application' to create Custom Metadata records. Admin should have this permission by default.
2. To apply the permission set - CustomMetadataLoader to the user who is using the tool. Go to Administer->Manage Users ->Permission Sets. Click on Custom Metadata Loader.
3  You will be taken to Permission Set page - Click on Manage Assignments. Then click Add Assignments. Choose the user/users. Then click Assign. Then Done. Now the perm set should be successfully assigned.
4. Create a CSV file with a header that contains the field API names, including the org namespace. Either Label or Developer Name is required. A sample csv for CountryMapping__mdt is in the same folder as this README file.
5. Next you are ready to use the tool - Select Custom Metadata Loader from the app menu in your org, then go to the Custom Metadata Loader tab.The app will prompt you to create a remote site setting if it is missing.
6. Select the CSV file and the corresponding custom metadata type.
7. Click 'Create/Update custom metadata' to bulk load the records from the CSV file into your org.

# How to use custom metadata migrator

Use one of the below option to migrate Custom Settings or Custom Objects to Custom Metadata Types. Go to the 'Custom Metadata Migrator' tab

### Option 1: Migrate Custom Settings/Custom Objects to new Custom Metadata Type

Input the following:

	--Api name of Custom Setting or Custom Object (e.g. VAT_Settings_CS__c)
	--Api name of Custom Metadata Types (e.g. VAT_Settings__mdt)

Click on 'Migrate'

### Option 2: Migrate Custom Settings/Custom Objects to existing Custom Metadata Type

Input the following:

	--Api name of Custom Setting (e.g. VAT_Settings_CS__c)
	--Select the name of existing Custom Metadata Types

Click on 'Migrate'

### Option 3: Migrate Custom Settings/Custom Objects to existing Custom Metadata Type (using simple mapping)

Input the following:

	--Api name of Custom Setting.fieldName (e.g. VAT_Settings_CS__c.Active__c)
	--Api name of Custom Metadata Types.fieldName (e.g. VAT_Settings__mdt.Active__c)

Click on 'Migrate'

### Option 4: Migrate Custom Settings/Custom Objects to existing Custom Metadata Type (using custom mapping)

Input the following:

	--Api Name of Custom Setting (e.g. VAT_Settings_CS__c)
	--Api Name of Custom Metadata Types (e.g. VAT_Settings__mdt)
	--Json Mapping (Sample below)
	{
		"Active__c" : "IsActive__c",
		"Timeout__c" : "GlobalTimeout__c",
	}
	Please note, key should be the Custom Setting/Object field name and that the value is the CMT field name.

Click on 'Migrate'

## Custom metadata migrator: more details

1. Custom metadata migrator provides two different options to do the migration:
	- Sync Operation: Migration will happen synchronously. Maximum 200 records can be migrated.
	- Async Operation: Migration will happen asynchronously. Maximum 50000 records can be migrated.
			To check the status of async migration, go to Deploy -> Deployment Status

2. Custom Metadata Types label and names
	- Custom Setting/Custom Object record name converted into Custom Metadata Types label and name.
	- Custom Setting name special character replaced with "_" in Custom Metadata Type names
	- If Custom Setting name starts with digit, then Custom Metadata Types name will be prepended with "X"

3. Custom Settings of type hierarchy not supported.

4. Custom Objects with field types not supported in Custom Metadata Types not supported.

5. Currency field on Custom Settings can't be migrated, you can use custom mapping to either avoid mapping or to map to another field.



================================================
FILE: custom_md_loader/applications/Custom_Metadata_Loader.app
================================================
<?xml version="1.0" encoding="UTF-8"?>
<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
    <defaultLandingTab>standard-home</defaultLandingTab>
    <description>Custom metadata record loader from a CSV file.</description>
    <label>Custom Metadata Loader</label>
    <tab>Custom_Metadata_Loader</tab>
    <tab>CMT_Migrator</tab>
</CustomApplication>


================================================
FILE: custom_md_loader/classes/AppConstants.cls
================================================
/**
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
public class AppConstants {

    public static final String QUALIFIED_API_NAME_ATTRIBUTE = 'QualifiedApiName';
    public static final String FULL_NAME_ATTRIBUTE = 'FullName';
    public static final String LABEL_ATTRIBUTE = 'Label';
    public static final String DEV_NAME_ATTRIBUTE = 'DeveloperName';
    public static final String DESC_ATTRIBUTE = 'Description';
    public static final String MDT_SUFFIX = '__mdt';
    
    public static final String CS_NAME_ATTRIBUTE = 'Name';
    public static final String SELECT_STRING = 'Select type';
    
    public static final String HEADER_MISSING_DEVNAME_AND_LABEL = 'Header must contain atleast one of these two fields - '+ DEV_NAME_ATTRIBUTE + ', ' + LABEL_ATTRIBUTE +'.';

    // Do not change value for ERROR_UNAUTHORIZED_ENDPOINT
 	public static final String ERROR_UNAUTHORIZED_ENDPOINT	= 'Unauthorized endpoint, please check Setup';	   

}

================================================
FILE: custom_md_loader/classes/AppConstants.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/CSVFileUtil.cls
================================================
/* 
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
 
public class CSVFileUtil {
	//from https://developer.salesforce.com/page/Code_Samples#Parse_a_CSV_with_APEX
    public static List<List<String>> parseCSV(Blob csvFileBody,Boolean skipHeaders) {
        if(csvFileBody == null) {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, Label.FILE_MISSING);
            ApexPages.addMessage(errorMessage);
            return null;
        }
        
        String contents = csvFileBody.toString();
        
        List<List<String>> allFields = new List<List<String>>();

        // replace instances where a double quote begins a field containing a comma
        // in this case you get a double quote followed by a doubled double quote
        // do this for beginning and end of a field
        contents = contents.replaceAll(',"""',',"DBLQT').replaceall('""",','DBLQT",');
        // now replace all remaining double quotes - we do this so that we can reconstruct
        // fields with commas inside assuming they begin and end with a double quote
        contents = contents.replaceAll('""','DBLQT');
	//windows case - replace all carriage + new line character to just new line character
	contents = contents.replaceAll('\r\n','\n');
        //now replace all return char to new line character
        contents = contents.replaceAll('\r','\n');
        // we are not attempting to handle fields with a newline inside of them
        // so, split on newline to get the spreadsheet rows
        List<String> lines = new List<String>();
        try {
            lines = contents.split('\n');
        } catch (System.ListException e) {
            System.debug('Limits exceeded?' + e.getMessage());
        }
        Integer num = 0;
        for(String line : lines) {
            // check for blank CSV lines (only commas)
            if (line.replaceAll(',','').trim().length() == 0) break;
            
            List<String> fields = line.split(',');  
            List<String> cleanFields = new List<String>();
            String compositeField;
            Boolean makeCompositeField = false;
            for(String field : fields) {
                if (field.startsWith('"') && field.endsWith('"')) {
                    cleanFields.add(field.replaceAll('DBLQT','"').trim());
                } else if (field.startsWith('"')) {
                    makeCompositeField = true;
                    compositeField = field;
                } else if (field.endsWith('"')) {
                    compositeField += ',' + field;
                    cleanFields.add(compositeField.replaceAll('DBLQT','"').trim());
                    makeCompositeField = false;
                } else if (makeCompositeField) {
                    compositeField +=  ',' + field;
                } else {
                    cleanFields.add(field.replaceAll('DBLQT','"').trim());
                }
            }
            
            allFields.add(cleanFields);
        }
        if (skipHeaders) allFields.remove(0);
        return allFields;       
    }
}


================================================
FILE: custom_md_loader/classes/CSVFileUtil.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/CustomMetadataLoaderController.cls
================================================
/* 
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
 
public class CustomMetadataLoaderController {
	public String host {get; set;}
    public String metadataResponse {get; set;}
    public Boolean metadataConnectionWarning {get; set;}
    public String prefixOrLocal {get; set;}

    public PageReference checkMdApi() {
        
        if (MetadataUtil.checkMetadataAPIConnection()) {
            return continueToUploader();
        }
        // Get Host Domain
        host = ApexPages.currentPage().getHeaders().get('Host');
        // Get namespace prefix for picklist package or placeholder for pre-packaging
        prefixOrLocal = host.substringBefore('.').replaceAll('-', '_');
        metadataConnectionWarning = true;
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Unable to connect to the Salesforce Metadata API.'));
	    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'A Remote Site Setting must be created in your org before you can use this tool.'));
		ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Press the Create Remote Site Setting button to perform this step or refer to the post install step below to perform this manually.'));
        return null;
    }
    
    public PageReference continueToUploader() {
        return Page.CustomMetadataRecordUploader;
    }
    
    public PageReference displayMetadataResponse()
	{
    	// Display the response from the client side Metadata API callout
        if(metadataResponse.length()==0){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, 'Remote Site Setting dlrs_mdapi has been created.' ));
            metadataConnectionWarning = false;
        } else {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, metadataResponse));
            metadataConnectionWarning = true;
        }
        return null;
	}
}


================================================
FILE: custom_md_loader/classes/CustomMetadataLoaderController.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/CustomMetadataLoaderControllerTest.cls
================================================
/* 
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
 
@IsTest
public class CustomMetadataLoaderControllerTest {

    public static testmethod void testCheckMdApiSucceeds() {
        CustomMetadataLoaderController cntlr = setup();
        PageReference result = cntlr.checkMdApi();
        System.assertEquals(Page.CustomMetadataRecordUploader.getUrl(), result.getUrl());
    }
    
    public static testmethod void testCheckMdApiFails() {
        CustomMetadataLoaderController cntlr = setup();
        ApexPages.currentPage().getHeaders().put('Host', 'na1.salesforce.com');
        MetadataUtil.mdApiStatus = MetadataUtil.Status.UNAVAILABLE;
        try {
            PageReference result = cntlr.checkMdApi();
            System.assertEquals(result, null);
            System.assertEquals('na1', cntlr.prefixOrLocal);
        } finally {
            MetadataUtil.mdApiStatus = MetadataUtil.Status.NOT_CHECKED;
        }
    }
    
    public static testmethod void testDisplayMetadataResponse() {
        CustomMetadataLoaderController cntlr = setup();
        cntlr.metadataResponse = '';
        cntlr.displayMetadataResponse();
        System.assert(!cntlr.metadataConnectionWarning);
        cntlr.metadataResponse = 'Danger, Will Robinson!';
        cntlr.displayMetadataResponse();
        System.assert(cntlr.metadataConnectionWarning);
    }
    
    static CustomMetadataLoaderController setup() {
        Test.setMock(WebServiceMock.class, new MDWrapperWebServiceMock());
        return new CustomMetadataLoaderController();
    }
}


================================================
FILE: custom_md_loader/classes/CustomMetadataLoaderControllerTest.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/CustomMetadataUploadController.cls
================================================
/* 
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
 
public class CustomMetadataUploadController {
    static MetadataService.MetadataPort service = MetadataUtil.getPort();    
    
    private final Set<String> standardFieldsInHeader = new Set<String>();
    private List<String> nonSortedApiNames;
    
    public boolean showRecordsTable{get;set;}
    public String selectedType{get;set;}
    public Blob csvFileBody{get;set;}
    public SObject[] records{get;set;}
    public List<SelectOption> cmdTypes{public get;set;}
    public List<String> fieldNamesForDisplay{public get;set;}
    
    public CustomMetadataUploadController() {
        showRecordsTable = false;
        loadCustomMetadataMetadata();
        
        //No full name here since we don't want to allow that in the csv header. It is a generated field using type dev name and record dev name/label.
        standardFieldsInHeader.add(AppConstants.DEV_NAME_ATTRIBUTE);
        standardFieldsInHeader.add(AppConstants.LABEL_ATTRIBUTE);
        standardFieldsInHeader.add(AppConstants.DESC_ATTRIBUTE);
    }
    
    /**
      * Queries to find all custom metadata types in the org and make it available to the VF page as drop down
    */
    private void loadCustomMetadataMetadata(){
        List<SObject> entityDefinitions =[select QualifiedApiName from EntityDefinition where IsCustomizable =true];
        for(SObject entityDefinition : entityDefinitions){
            String entityQualifiedApiName = (String)entityDefinition.get(AppConstants.QUALIFIED_API_NAME_ATTRIBUTE);
            if(entityQualifiedApiName.endsWith(AppConstants.MDT_SUFFIX)){
                if(cmdTypes == null) {
                    cmdTypes = new List<SelectOption>();
                    cmdTypes.add(new SelectOption(AppConstants.SELECT_STRING, AppConstants.SELECT_STRING));
                }
                cmdTypes.add(new SelectOption(entityQualifiedApiName, entityQualifiedApiName));
            }
        }
    }
    
    public PageReference upsertCustomMetadata() {
        ApexPages.getMessages().clear();
        showRecordsTable = false;
        
        importCSVFileAndCreateUpdateCmdRecords();
        System.debug(ApexPages.getMessages());
        if(ApexPages.getMessages().size() > 0) {
            if(!(ApexPages.getMessages().size() == 1 && ApexPages.getMessages()[0].getDetail().contains('DUPLICATE_DEVELOPER_NAME'))) {
             return null;
            }
        }
        
	//reset the file variable
        csvFileBody = null;

        if(nonSortedApiNames == null) {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,
                                                 'Insert/Update was successful but something went wrong fetching the records.');
            ApexPages.addMessage(errorMessage);
            return null;
        }
        
        fieldNamesForDisplay = new List<String>();
        String selectQuery = 'SELECT ';
        Integer count = 0;
        for(String selectField : nonSortedApiNames) {
            if(!selectField.equals(AppConstants.DESC_ATTRIBUTE)) { //not supported in soql
                if(count != 0) {
                    selectQuery = selectQuery + ', ';
                }
                selectQuery = selectQuery + selectField;
                fieldNamesForDisplay.add(selectField);
                count++;
        	}
        }
        selectQuery = selectQuery + ' FROM ' + selectedType;
        records = Database.query(selectQuery);
        showRecordsTable = true;
        return null;
    }
    
    public void importCSVFileAndCreateUpdateCmdRecords(){
        List<List<String>> fields;
        try{ 
           fields = CSVFileUtil.parseCSV(csvFileBody, false);
        } catch (Exception e) {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,
                                                 'An error has occured while importin data.'+
                                                 ' Please make sure input csv file is correct'  + 
                                                 '<br/>' + e.getMessage() + '<br/>' + e.getCause());
            ApexPages.addMessage(errorMessage);
            return;
        }
        
        if(ApexPages.getMessages().size() > 0) {
          return;
        }
        
        if(fields == null || (fields != null && fields.size() < 1)) {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, Label.EMPTY_FILE);
            ApexPages.addMessage(errorMessage);
            return;
        }
           
        if(selectedType == AppConstants.SELECT_STRING) {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, Label.TYPE_OPTION_NOT_SELECTED);
            ApexPages.addMessage(errorMessage);
            return;
        }
        
        //validate header fields
        List<String> header = fields[0];
        /*if(!isHeaderValid(new Set<String>(header), selectedType)) {
            return;
        }*/
	// separated out columns as they were coming as string like: "DeveloperName;Label;Description;"
	// it would pass the conditions under isHeadervalid() 
	Set<String> columnSet = new Set<String>();
        
        for(String headerColumn :header) {
            if (headerColumn == null) {
                continue;
            }
            
            for (String column :headerColumn.split(';')) {
                columnSet.add(column);
            }
        }
        
        if(!isHeaderValid(columnSet, selectedType)) {
            return;
        }
        
        //transform to custom metadata - bulk size = 200 records
        Integer maxLoadSize = 200;
        for(Integer i = 1; i < fields.size(); i = i + maxLoadSize) {
            MetadataUtil.transformToCustomMetadataAndCreateUpdate(standardFieldsInHeader, subset(fields, i, maxLoadSize), header, selectedType, i);
        }
    }
    
    private boolean isHeaderValid(Set<String> fieldNamesInHeader, String selectedType) {
        //label or devName - atleast one of the two must be specified
        if(!fieldNamesInHeader.contains(AppConstants.DEV_NAME_ATTRIBUTE) && !fieldNamesInHeader.contains(AppConstants.LABEL_ATTRIBUTE)) {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, AppConstants.HEADER_MISSING_DEVNAME_AND_LABEL);
            ApexPages.addMessage(errorMessage);
            return false;
        }
        
        System.debug(selectedType);
        
        
        
        Set<String> fieldApiNames = new Set<String>(standardFieldsInHeader);
        nonSortedApiNames = new List<String>(standardFieldsInHeader);
        
        DescribeSObjectResult objDef = Schema.getGlobalDescribe().get(selectedType).getDescribe();
        Map<String, SObjectField> fields = objDef.fields.getMap();
        
        for(String fieldName : fields.keySet()) {
            DescribeFieldResult fieldDesc = fields.get(fieldName).getDescribe();
            String fieldQualifiedApiName = fieldDesc.getName();
            
            if(fieldQualifiedApiName.endsWith('__c')){
                fieldApiNames.add(fieldQualifiedApiName);
                nonSortedApiNames.add(fieldQualifiedApiName);
            }
        }
        
        if(!fieldApiNames.containsAll(fieldNamesInHeader)) {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'Header must contain the api names of the fields. ' + '<br/>' + 
                                                                   'Fields allowed for this type: ' + nonSortedApiNames + '<br/>' +
                                                                   'Fields in file header: ' + fieldNamesInHeader);
            ApexPages.addMessage(errorMessage);
            return false;
        }
        return true;
    }
    
    //https://gist.github.com/fractastical/989792
    public static List<List<String>> subset(List<List<String>> list1, Integer startIndex, Integer count) {
        List<List<String>> returnList = new List<List<String>>();
        if(list1 != null && list1.size() > 0 && startIndex >= 0 && startIndex <= list1.size()-1 && count > 0){
            for(Integer i = startIndex; i < list1.size() && i - startIndex < count; i++){
                returnList.add(list1.get(i));
            }
        }
        return returnList;
    }
    
    //for tests
    public void setCsvBlobForTest(Blob file) {
        this.csvFileBody = file;
    }
    
    public void setSelectedTypeForTest(String selectedType) {
        this.selectedType = selectedType;
    }
}


================================================
FILE: custom_md_loader/classes/CustomMetadataUploadController.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/CustomMetadataUploadControllerTest.cls
================================================
/* 
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
 
@isTest(SeeAllData=true)
public class CustomMetadataUploadControllerTest {
    
    public static testmethod void testUploadNoFile() {
		CustomMetadataUploadController ctrl = setup(null);
        invokeCreateCMAndValidateError(ctrl, Label.FILE_MISSING);
    }
    
    public static testmethod void testUploadEmptyFile() {
		CustomMetadataUploadController ctrl = setup(Blob.valueOf(''));
        invokeCreateCMAndValidateError(ctrl, Label.EMPTY_FILE);
    }
    
    public static testmethod void testSelectedTypeMissing() {
		CustomMetadataUploadController ctrl = setup(Blob.valueOf('Text__c'), AppConstants.SELECT_STRING);
        invokeCreateCMAndValidateError(ctrl, Label.TYPE_OPTION_NOT_SELECTED);
    }
    
    public static testmethod void testInvalidHeaderMissingFields() {
		CustomMetadataUploadController ctrl = setup(Blob.valueOf('Text__c'));
        invokeCreateCMAndValidateError(ctrl, AppConstants.HEADER_MISSING_DEVNAME_AND_LABEL);
    }
    
    public static testmethod void testInvalidHeaderWrongFields() {
		CustomMetadataUploadController ctrl = setup(Blob.valueOf('Label,Text__c'));
        
        ctrl.upsertCustomMetadata();
        ApexPages.Message[] msgs=ApexPages.getMessages();
		System.assert(msgs.size() == 1);
        System.assert(msgs[0].getSummary().contains('Header must contain the api names of the fields.'), 'Actual message:' + msgs[0]);
    }
    
    public static testmethod void testCreateCustomMetadata() {
        String countryLabel = 'AmericaTest'+Math.random();
		CustomMetadataUploadController ctrl = setup(Blob.valueOf('Label,CountryCode__c,CountryName__c\n'+countryLabel+',US,America'));
        
        ctrl.upsertCustomMetadata();
        
        ApexPages.Message[] msgs = ApexPages.getMessages();
        System.assert(msgs.size() == 0, 'Error messages:' + msgs);
    }
    
    public static testmethod void testCreateCustomMetadataWithDevName() {
        String countryLabel = 'AmericaTest'+Math.random();
		CustomMetadataUploadController ctrl = setup(Blob.valueOf('DeveloperName,CountryCode__c,CountryName__c\n'+countryLabel+',US,America'));
        
        ctrl.upsertCustomMetadata();
        
        ApexPages.Message[] msgs = ApexPages.getMessages();
        System.assert(msgs.size() == 0, 'Error messages:' + msgs);
    }
    
    public static testmethod void testInvalidFileRowSizeDoesntMatch() {
        String countryLabel = 'AmericaTest'+Math.random();
		CustomMetadataUploadController ctrl = setup(Blob.valueOf('DeveloperName,CountryCode__c,CountryName__c\n'+countryLabel+',US'));
        
        invokeCreateCMAndValidateError(ctrl, System.Label.INVALID_FILE_ROW_SIZE_DOESNT_MATCH + '1');
    }
    
    static CustomMetadataUploadController setup(Blob file) {
        return setup(file, 'CountryMapping__mdt');
    }

    static CustomMetadataUploadController setup(Blob file, String selectedType) {
        Test.setMock(WebServiceMock.class, new MDWrapperWebServiceMock());
        CustomMetadataUploadController ctrl = new CustomMetadataUploadController();
        ctrl.setSelectedTypeForTest(selectedType);
        ctrl.setCsvBlobForTest(file);
        return ctrl;
    }
    
    static void invokeCreateCMAndValidateError(CustomMetadataUploadController ctrl, String errorMsg) {
        ctrl.upsertCustomMetadata();
        ApexPages.Message[] msgs = ApexPages.getMessages();
		System.assert(msgs.size() == 1);
        System.assert(msgs[0].getSummary().equals(errorMsg), 'Actual message:' + msgs[0]);
    }
}


================================================
FILE: custom_md_loader/classes/CustomMetadataUploadControllerTest.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/JsonUtilities.cls
================================================
/* 
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
 
/**
 * Utilities class for common manipulation of json format data
 *
 */
public with sharing class JsonUtilities {

    public class JsonUtilException extends Exception {}
    
    /**
    * This basic method takes a string formatted as json and returns a map<String,String>
    * containing the name/value pairs.  If the input is empty or is not formatted correctly
    * the method throws a JsonUtilException exception.
    **/
    Public static Map<String, String> getValuesFromJson(String jsonString) {
        Map<String, Object> jsonObjMap;
        Map<String, String> jsonMap = new Map<String, String>();
        if (String.isBlank(jsonString)){               
            throw new JsonUtilException(Label.ERROR_JSON_EMPTY);
        }
        try {                
            jsonObjMap = (Map<String, Object>)JSON.deserializeUntyped(jsonString);
            if(jsonObjMap == null || jsonObjMap.size() == 0) {
                throw new JsonUtilException(Label.ERROR_JSON_EMPTY);
            } else {
                for (String pKey : jsonObjMap.keySet() ) {
                    try {
                        String pVal = (String)jsonObjMap.get(pKey);
                        jsonMap.put(pKey, pVal);
                    } catch (exception e) {
                        throw new JsonUtilException(Label.ERROR_JSON_BAD_FORMAT, e);
                    }
                }
            }                    
            return jsonMap;
        } catch (Exception e) {
            throw new JsonUtilException(Label.ERROR_JSON_BAD_FORMAT, e);
        }   
    }
    

}


================================================
FILE: custom_md_loader/classes/JsonUtilities.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MDWrapperWebServiceMock.cls
================================================
/* 
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
 
@isTest                        
global class MDWrapperWebServiceMock implements WebServiceMock {
   global void doInvoke(
           Object stub,
           Object request,
           Map<String, Object> response,
           String endpoint,
           String soapAction,
           String requestName,
           String responseNS,
           String responseName,
           String responseType) {
           if(responseType == 'MetadataService.listMetadataResponse_element'){
               response.put('response_x', new MetadataService.listMetadataResponse_element()); 
           } else if (responseType == 'MetadataService.createMetadataResponse_element') {
                MetadataService.createMetadataResponse_element respElt =
                    new MetadataService.createMetadataResponse_element();
                respElt.result = new List<MetadataService.SaveResult>();
                MetadataService.SaveResult sr = new MetadataService.SaveResult();
                sr.success = true;
                respElt.result.add(sr);
                response.put('response_x', respElt);
        	} else if (responseType == 'MetadataService.upsertMetadataResponse_element') {
        		MetadataService.upsertMetadataResponse_element respElt = new MetadataService.upsertMetadataResponse_element();
        		response.put('response_x', respElt);
        	}
   }
}


================================================
FILE: custom_md_loader/classes/MDWrapperWebServiceMock.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataApexApiLoader.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public with sharing class MetadataApexApiLoader extends MetadataLoader {

  // TODO: MetadataDeployStatus: We may use in future to provide status on UI (polling or email)
  public MetadataDeployStatus mdDeployStatus {get;set;}
  // TODO: MetadataDeployCallback: We may use in future to provide status on UI (polling or email)
  public MetadataDeployCallback callback {get;set;}

  public MetadataApexApiLoader() {
    this.mdDeployStatus = new MetadataApexApiLoader.MetadataDeployStatus();
    this.callback = new MetadataDeployCallback();
  }

  public MetadataApexApiLoader.MetadataDeployStatus getMdDeployStatus() {
    return this.mdDeployStatus;
  }

  public MetadataApexApiLoader.MetadataDeployCallback getCallback() {
    return this.callback;
  }

  public override void migrateAsIsWithObjCreation(String csName, String cmtName) {
    List<MetadataResponse.Message> messages = new List<MetadataResponse.Message>();
    messages.add(new MetadataResponse.Message(100, Label.MSG_NOT_SUPPORTED));
    response.setIsSuccess(false);
    response.setMessages(messages);
  }

  public override void migrateAsIsMapping(String csName, String cmtName) {
    super.migrateAsIsMapping(csName, cmtName);
    buildResponse();
  }

  public override void migrateSimpleMapping(String csNameWithField, String cmtNameWithField) {
    super.migrateSimpleMapping(csNameWithField, cmtNameWithField);
    buildResponse();
  }

  public override void migrateCustomMapping(String csName, String cmtName, String mapping) {
    super.migrateCustomMapping(csName, cmtName, mapping);
    buildResponse();
  }

  private void buildResponse() {
    if(response.IsSuccess()) {
      List<MetadataResponse.Message> messages = new List<MetadataResponse.Message>();
      messages.add(new MetadataResponse.Message(100, Label.MSG_MIGRATION_IN_PROGRESS + getMdDeployStatus().getJobId()));
      response.setIsSuccess(true);
      response.setMessages(messages);
    }
  }

  public override void migrate(MetadataMappingInfo mappingInfo) {
    System.debug('MetadataApexApiLoader.migrate -->');
    try {
      Map<String, Schema.DescribeFieldResult> descFieldResultMap = mappingInfo.getSrcFieldResultMap();
      String typeDevName = mappingInfo.getCustomMetadadataTypeName()
          .subString(0, mappingInfo.getCustomMetadadataTypeName().indexOf(AppConstants.MDT_SUFFIX));
      List<Metadata.CustomMetadata> records = new List<Metadata.CustomMetadata>();
      for(sObject csRecord : mappingInfo.getRecordList()) {

        Metadata.CustomMetadata customMetadataRecord = new Metadata.CustomMetadata();
        customMetadataRecord.values = new List<Metadata.CustomMetadataValue>();

        if(csRecord.get(AppConstants.CS_NAME_ATTRIBUTE) != null) {
          String strippedLabel = (String)csRecord.get(AppConstants.CS_NAME_ATTRIBUTE);
          String tempVal = strippedLabel.substring(0, 1);

          if(tempVal.isNumeric()) {
            strippedLabel = 'X' + strippedLabel;
          }
          strippedLabel = strippedLabel.replaceAll('\\W+', '_').replaceAll('__+', '_').replaceAll('\\A[^a-zA-Z]+', '').replaceAll('_$', '');
          System.debug('strippedLabel ->' + strippedLabel);

          // default fullName to type_dev_name.label
          customMetadataRecord.fullName = typeDevName + '.'+ strippedLabel;
          customMetadataRecord.label = (String)csRecord.get(AppConstants.CS_NAME_ATTRIBUTE);
        }
        for(String fieldName : mappingInfo.getCSToMDT_fieldMapping().keySet()) {
          Schema.DescribeFieldResult descCSFieldResult = descFieldResultMap.get(fieldName.toLowerCase());

          if(mappingInfo.getCSToMDT_fieldMapping().get(fieldName).endsWith('__c')) {
            Metadata.CustomMetadataValue cmv = new Metadata.CustomMetadataValue();
            cmv.field = mappingInfo.getCSToMDT_fieldMapping().get(fieldName);
            cmv.value = csRecord.get(fieldName);
            customMetadataRecord.values.add(cmv);
          }
        }
        records.add(customMetadataRecord);
      }

      callback.setMdDeployStatus(mdDeployStatus);

      Metadata.DeployContainer deployContainer = new Metadata.DeployContainer();
      for(Metadata.CustomMetadata record : records) {
        deployContainer.addMetadata(record);
      }

      // Enqueue custom metadata deployment
      Id jobId = Metadata.Operations.enqueueDeployment(deployContainer, callback);
      mdDeployStatus.setJobId(jobId);
    }
    catch (Exception e) {
      System.debug('MetadataApexApiLoader.Error Message=' + e.getMessage());
      List<MetadataResponse.Message> messages = new List<MetadataResponse.Message>();
      messages.add(new MetadataResponse.Message(100, e.getMessage()));

      response.setIsSuccess(false);
      response.setMessages(messages);
    }
  }

  // TODO: Status is still a work in progress. In future, we may use this to provide
  // status on UI (polling or email)
  public class MetadataDeployStatus {
    public Id jobId {get;set;}
    public Metadata.DeployStatus deployStatus {get;set;}
    public boolean success {get;set;}

    public MetadataDeployStatus() {}

    public Id getJobId() {
      return this.jobId;
    }
    public void setJobId(Id jobId) {
      this.jobId = jobId;
    }

    public Metadata.DeployStatus getDeployStatus() {
      return this.deployStatus;
    }
    public void setDeployStatus(Metadata.DeployStatus deployStatus) {
      this.deployStatus = deployStatus;
    }

    public boolean getSuccess() {
      return this.success;
    }
    public void setSuccess(boolean success) {
      this.success = success;
    }
  }

  // TODO: Callback is still a work in progress. In future, we may use this to provide
  // status on UI (polling or email)
  public class MetadataDeployCallback implements Metadata.DeployCallback {

    public MetadataApexApiLoader.MetadataDeployStatus mdDeployStatus {get;set;}

    public void setMdDeployStatus(MetadataApexApiLoader.MetadataDeployStatus mdDeployStatus) {
      this.mdDeployStatus = mdDeployStatus;
    }

    public MetadataDeployCallback() {
    }

    public void handleResult(Metadata.DeployResult result,
        Metadata.DeployCallbackContext context) {

      if (result.status == Metadata.DeployStatus.Succeeded) {
        mdDeployStatus.setSuccess(true);
        mdDeployStatus.setDeployStatus(result.status);
      }
      else if (result.status == Metadata.DeployStatus.InProgress) {
        // Deployment In Progress
        mdDeployStatus.setSuccess(false);
        mdDeployStatus.setDeployStatus(result.status);
      }
      else {
        mdDeployStatus.setSuccess(false);
        mdDeployStatus.setDeployStatus(result.status);
        // Deployment was not successful
      }
    }
  }

}


================================================
FILE: custom_md_loader/classes/MetadataApexApiLoader.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataLoader.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public virtual with sharing class MetadataLoader {

  public enum MetadataOpType { APEXWRAPPER, METADATAAPEX }

  public MetadataResponse response;
  public MetadataMapperDefault mapper;

  public MetadataLoader() {
    response = new MetadataResponse(true, null, null);
  }

  /**
   *  This will first create custom object and then migrates the records.
   *	This assumes that Custom Setting and MDT have the same API field names and
   *  same field data type.
   *  csName: Label, DeveloperName, Description (We might need it for migration)
   *  cmtName: e.g. VAT_Settings if mdt is 'VAT_Settings__mdt'
   */
  public virtual void migrateAsIsWithObjCreation(String csName, String cmtName) {
    MetadataMappingInfo mappingInfo = null;
    try {
      mapper = MetadataMapperFactory.getMapper(MetadataMapperType.ASIS);
      mappingInfo = mapper.mapper(csName, cmtName, null);
    }
    catch (Exception e) {
      System.debug('MetadataLoader.Error Message=' + e.getMessage());
      List<MetadataResponse.Message> messages = new List<MetadataResponse.Message>();
      messages.add(new MetadataResponse.Message(100, Label.MSG_CUSTOM_SETTINGS_EXISTS));
      messages.add(new MetadataResponse.Message(100, Label.MSG_CS_MDT_REQ));
      messages.add(new MetadataResponse.Message(200, Label.MSG_CHECK_API_NAMES));
      messages.add(new MetadataResponse.Message(300, e.getMessage()));
      response.setIsSuccess(false);
      response.setMessages(messages);
    }
  }

  /**
   *  This assumes that CS and MDT have the same API field names.
   *
   *  csName: Label, DeveloperName, Description (We might need it for migration)
   *  cmtName: e.g. VAT_Settings if mdt is 'VAT_Settings__mdt'
   */
  public virtual void migrateAsIsMapping(String csName, String cmtName) {
    MetadataMappingInfo mappingInfo = null;
    try {
      mapper = MetadataMapperFactory.getMapper(MetadataMapperType.ASIS);
      mappingInfo = mapper.mapper(csName, cmtName, null);
      migrate(mappingInfo);
    }
    catch (Exception e) {
      System.debug('MetadataLoader.Error Message=' + e.getMessage());
      List<MetadataResponse.Message> messages = new List<MetadataResponse.Message>();
      messages.add(new MetadataResponse.Message(100, Label.MSG_CS_MDT_EXISTS));
      messages.add(new MetadataResponse.Message(100, Label.MSG_CS_MDT_REQ));
      messages.add(new MetadataResponse.Message(200, Label.MSG_CHECK_API_NAMES));
      messages.add(new MetadataResponse.Message(300, e.getMessage()));
      response.setIsSuccess(false);
      response.setMessages(messages);
      return;
    }
  }

  /**
   *  csNameAndField: Label, DeveloperName, Description (We might need it for migration)
   *  cmtNameAndField: e.g. VAT_Settings if mdt is 'VAT_Settings__mdt'
   */
  public virtual void migrateSimpleMapping(String csNameAndField, String cmtNameAndField) {
    MetadataMappingInfo mappingInfo = null;
    try {
      mapper = MetadataMapperFactory.getMapper(MetadataMapperType.SIMPLE);
      mappingInfo = mapper.mapper(csNameAndField, cmtNameAndField, null);
      migrate(mappingInfo);
    }
    catch (Exception e) {
      System.debug('MetadataLoader.Error Message=' + e.getMessage());
      List<MetadataResponse.Message> messages = new List<MetadataResponse.Message>();
      messages.add(new MetadataResponse.Message(100, Label.MSG_CS_MDT_EXISTS));
      messages.add(new MetadataResponse.Message(100, Label.MSG_CS_MDT_FIELD_NAME_REQ));
      messages.add(new MetadataResponse.Message(200, Label.MSG_CS_MDT_FIELD_NAME_FORMAT));
      messages.add(new MetadataResponse.Message(300, Label.MSG_CHECK_API_NAMES));
      messages.add(new MetadataResponse.Message(400, e.getMessage()));
      response.setIsSuccess(false);
      response.setMessages(messages);
      return;
    }
  }

  /**
   *  This assumes that CS and MDT have the same API field names.
   *
   *  csName: Label, DeveloperName, Description (We might need it for migration)
   *  cmtName: e.g. VAT_Settings if mdt is 'VAT_Settings__mdt'
   *  mapping: e.g. Json mapping between CS field Api and CMT field Api names
   */
  public virtual void migrateCustomMapping(String csName, String cmtName, String mapping) {
    MetadataMappingInfo mappingInfo = null;
    try {
      mapper = MetadataMapperFactory.getMapper(MetadataMapperType.CUSTOM);
      mappingInfo = mapper.mapper(csName, cmtName, mapping);
      migrate(mappingInfo);
    }
    catch (Exception e) {
      System.debug('MetadataLoader.Error Message=' + e.getMessage());
      List<MetadataResponse.Message> messages = new List<MetadataResponse.Message>();
      messages.add(new MetadataResponse.Message(100, Label.MSG_CS_MDT_EXISTS));
      messages.add(new MetadataResponse.Message(100, Label.MSG_CS_MDT_MAPPING_REQ));
      messages.add(new MetadataResponse.Message(200, Label.MSG_CHECK_API_NAMES));
      messages.add(new MetadataResponse.Message(200, Label.MSG_JSON_FORMAT));
      messages.add(new MetadataResponse.Message(300, Label.MSG_JSON_API_NAMES));
      messages.add(new MetadataResponse.Message(400, e.getMessage()));
      response.setIsSuccess(false);
      response.setMessages(messages);
      return;
    }
  }

  public virtual void migrate(MetadataMappingInfo mappingInfo) {
  }

  public MetadataMapperDefault getMapper() {
    return mapper;
  }

  public MetadataResponse getMetadataResponse() {
    return response;
  }

}


================================================
FILE: custom_md_loader/classes/MetadataLoader.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataLoaderClient.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

/**
 * Please note this is just a sample usage class. You need to replace hard-coded
 * values with real values.
 *
 **/
public class MetadataLoaderClient {

  public void migrateMetatdataApex() {
  }

  /*********************************************************
   * Desc This will create custom object and then migrate Custom Settings data
   * to Custom Metadata Types records as is
   *
   * @param Name
   *            of Custom Setting Api (VAT_Settings_CS__c)
   * @param Name
   *            of Custom Metadata Types Api (VAT_Settings__mdt)
   * @return
   *********************************************************/
  public void migrateAsIsWithObjCreation(String csName, String mdtName) {
    MetadataLoader loader = MetadataLoaderFactory.getLoader(MetadataOpType.APEXWRAPPER);
    loader.migrateAsIsWithObjCreation(csName, mdtName);
  }

  /*********************************************************
   * Desc Migrate Custom Settings data to Custom Metadata Types records as is
   *
   * @param Name
   *            of Custom Setting Api (VAT_Settings_CS__c)
   * @param Name
   *            of Custom Metadata Types Api (VAT_Settings__mdt)
   * @return
   *********************************************************/
  public void migrateAsIsMapping(String csName, String mdtName) {
    MetadataLoader loader = MetadataLoaderFactory.getLoader(MetadataOpType.APEXWRAPPER);
    loader.migrateAsIsMapping(csName, mdtName);
  }

  /*********************************************************
   * Desc Migrate Custom Settings data to Custom Metadata Types records if you
   * have only one field mapping
   *
   * @param Name
   *            of Custom Setting Api.fieldName (VAT_Settings_CS__c.Active__c)
   * @param Name
   *            of Custom Metadata Types Api.fieldMame
   *            (VAT_Settings__mdt.IsActive__c)
   * @return
   *********************************************************/
  public void migrateSimpleMapping(String csNameWithField,
      String mdtNameWithField) {
    MetadataLoader loader = MetadataLoaderFactory.getLoader(MetadataOpType.APEXWRAPPER);
    loader.migrateSimpleMapping(csNameWithField, mdtNameWithField);
  }

  /*********************************************************
   * Desc Migrate Custom Settings data to Custom Metadata Types records if you
   * have only different Api names in Custom Settings and Custom Metadata
   * Types
   *
   * @param Name
   *            of Custom Setting Api (VAT_Settings_CS__c)
   * @param Name
   *            of Custom Metadata Types Api (VAT_Settings__mdt)
   * @param Json
   *            Mapping (Sample below) { "Active__c" : "IsActive__c",
   *            "Timeout__c" : "GlobalTimeout__c", "EndPointURL__c" :
   *            "URL__c", }
   *
   * @return
   *********************************************************/
  public void migrateCustomMapping(String csName, String mdtName,
      String jsonMapping) {
    MetadataLoader loader = MetadataLoaderFactory.getLoader(MetadataOpType.APEXWRAPPER);
    loader.migrateCustomMapping(csName, mdtName, jsonMapping);
  }

}


================================================
FILE: custom_md_loader/classes/MetadataLoaderClient.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataLoaderFactory.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public with sharing class MetadataLoaderFactory {

    public static MetadataLoader getLoader(MetadataOpType mt) {
      MetadataLoader loader = null;

    if(mt == MetadataOpType.APEXWRAPPER) {
      loader = new MetadataWrapperApiLoader();
    }
    if(mt == MetadataOpType.METADATAAPEX) {
      loader = new MetadataApexApiLoader();
    }
    return loader;
    }

}


================================================
FILE: custom_md_loader/classes/MetadataLoaderFactory.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMapper.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

/**
 * Interface for mapping between source object and target object fields.
 * Implementation of this interface will handle the mapping between source
 * and target object fields.
 *
 * */
public interface MetadataMapper {

  /**
   * Maps the source fields with target fields.
   *
   * @param sFrom: source object
   * @param sFrom: target object
   * @param mapping: optional param, required for custom mapping in the form of json.
   * */
  MetadataMappingInfo mapper(String sFrom, String sTo, String mapping);

  // TODO: Currently, this is not implemented, but I think we should implement to
  // validate the fields that are not supported by Custom Metadata Types.

  /**
   * Validate the fields between source and target object.
   * e.g. If source Custom Object is having a field of type 'masterdetail',
   * then we should flag it an error or warning?
   *
   * */
  boolean validate();

  /**
   * Map for source-target field mapping
   *
   * */
  void mapSourceTarget();
}


================================================
FILE: custom_md_loader/classes/MetadataMapper.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMapperCustom.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

/**
 * Custom mapping between source and target object fields based on json.
 *
 * */
public with sharing class MetadataMapperCustom extends MetadataMapperDefault {

    private String csFieldName;
    private String mdtFieldName;
  private Map<String,String> fieldsMap;

  public MetadataMapperCustom() {
    super();
  }

  /**
   * Maps the source fields with target fields.
   *
   * @param sFrom: source object, e.g. VAT_Settings__c
   * @param sFrom: target object, e.g. VAT_Settings__mdt
   * @param mapping: json mapping, e.g. {"Field_cs_1__c", "Field_mdt_1__c"}
   * */
  public override MetadataMappingInfo mapper(String sFrom, String sTo, String mapping) {
      try {
        fetchSourceMetadataAndRecords(sFrom, sTo, mapping);
      mapSourceTarget();
      }
      catch (Exception e) {
        throw e;
      }
    return mappingInfo;
    }

    /**
     * Fetches source object metadata and builds the mapping info
     */
    private void fetchSourceMetadataAndRecords(String csName, String mdtName, String mapping) {
    if(!mdtName.endsWith(AppConstants.MDT_SUFFIX)) {
            throw new MetadataMigrationException(Label.MSG_MDT_END + AppConstants.MDT_SUFFIX);
        }

        List<String> srcFieldNames = new List<String>();
        Map<String,DescribeFieldResult> srcFieldResultMap = new Map<String, DescribeFieldResult>();

        try {
          mappingInfo.setCustomSettingName(csName);
          mappingInfo.setCustomMetadadataTypeName(mdtName);

        DescribeSObjectResult objDef = Schema.getGlobalDescribe().get(csName).getDescribe();
          Map<String, SObjectField> fields = objDef.fields.getMap();

          this.fieldsMap = JsonUtilities.getValuesFromJson(mapping);

          for(String fieldName: fieldsMap.keySet()) {
            srcFieldNames.add(fieldName);
            DescribeFieldResult fieldDesc = fields.get(fieldName).getDescribe();
            srcFieldResultMap.put(fieldName.toLowerCase(), fieldDesc);
        }

          String selectClause = 'SELECT ' + String.join(srcFieldNames, ', ') + ' ,Name ';
          String query = selectClause + ' FROM ' + csName + ' LIMIT 50000';

          List<sObject> recordList = Database.query(query);

      mappingInfo.setSrcFieldNames(srcFieldNames);
         mappingInfo.setRecordList(recordList);
         mappingInfo.setSrcFieldResultMap(srcFieldResultMap);
     }
    catch (Exception e) {
      System.debug('MetadataMapperCustom.Error Message=' + e.getMessage());
      throw e;
    }

    }

  // TODO: Currently, this is not implemented (well defaulted to true), but I think
  // we should implement to validate the fields that are not supported by Custom Metadata Types.

  /**
   * Validate the fields between source and target object.
   * e.g. If source Custom Object is having a field of type 'masterdetail',
   * then we should flag it an error or warning?
   *
   * */
  public override boolean validate(){
    return true;
  }

  /**
   * Map for source-target field mapping
   *
   * */
    public override void mapSourceTarget() {
      mappingInfo.setCSToMDT_fieldMapping(this.fieldsMap);
    }

}


================================================
FILE: custom_md_loader/classes/MetadataMapperCustom.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMapperDefault.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

/**
 * Default mapping between source and target object fields based on json.
 * This assumes that source object and target object are having exactly same
 * fields metadata.
 *
 * */
public virtual with sharing class MetadataMapperDefault implements MetadataMapper {

  protected MetadataMappingInfo mappingInfo;
  private List<String> srcFieldNames;

  public MetadataMapperDefault() {
    this.mappingInfo = new MetadataMappingInfo();
  }

  /**
   * Maps the source fields with target fields.
   *
   * @param sFrom: source object
   * @param sFrom: target object
   * @param mapping: optional param, in this case, its null
   * */
  public virtual MetadataMappingInfo mapper(String sFrom, String sTo, String mapping) {
    try {
      mappingInfo.setCustomSettingName(sFrom);
      mappingInfo.setCustomMetadadataTypeName(sTo);

      fetchSourceMetadataAndRecords(sFrom);
      mapSourceTarget();
    }
    catch (Exception e) {
      throw e;
    }
    return mappingInfo;
  }

    /**
     * Fetches source object metadata and builds the mapping info
     */
  private void fetchSourceMetadataAndRecords(String customSettingApiName) {

    if(!mappingInfo.getCustomMetadadataTypeName().endsWith(AppConstants.MDT_SUFFIX)) {
      throw new MetadataMigrationException(Label.MSG_MDT_END + AppConstants.MDT_SUFFIX);
    }

    srcFieldNames = new List<String>();
    Map<String,DescribeFieldResult> srcFieldResultMap = new Map<String, DescribeFieldResult>();

    try {
      DescribeSObjectResult objDef = Schema.getGlobalDescribe().get(customSettingApiName).getDescribe();
      Map<String, SObjectField> fields = objDef.fields.getMap();

      String selectFields = '';
      for(String fieldName : fields.keySet()) {
        DescribeFieldResult fieldDesc = fields.get(fieldName).getDescribe();
        String fieldQualifiedApiName = fieldDesc.getName();
        if(fieldQualifiedApiName.endsWith('__c')) {
          srcFieldNames.add(fieldQualifiedApiName);
        }
        srcFieldResultMap.put(fieldName.toLowerCase(), fieldDesc);

      }

      String selectClause = 'SELECT ' + String.join(srcFieldNames, ', ') + ' ,Name ';
      String query = selectClause + ' FROM ' + customSettingApiName  + ' LIMIT 50000';
      List<sObject> recordList = Database.query(query);

      mappingInfo.setSrcFieldNames(srcFieldNames);
      mappingInfo.setRecordList(recordList);
      mappingInfo.setSrcFieldResultMap(srcFieldResultMap);
    }
    catch (Exception e) {
      System.debug('MetadataMapperDefault.Error Message=' + e.getMessage());
      throw e;
    }
  }

  // TODO: Currently, this is not implemented (well defaulted to true), but I think
  // we should implement to validate the fields that are not supported by Custom Metadata Types.

  /**
   * Validate the fields between source and target object.
   * e.g. If source Custom Object is having a field of type 'masterdetail',
   * then we should flag it an error or warning?
   *
   * */
  public virtual boolean validate(){
    return true;
  }

  /**
   * Map for source-target field mapping
   *
   * */
  public virtual void mapSourceTarget() {
    Map<String, String> csToMDT_fieldMapping = mappingInfo.getCSToMDT_fieldMapping();
    for(String fieldName: srcFieldNames) {
      csToMDT_fieldMapping.put(fieldName, fieldName);
    }
  }

  public MetadataMappingInfo getMappingInfo() {
    return mappingInfo;
  }

}


================================================
FILE: custom_md_loader/classes/MetadataMapperDefault.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMapperFactory.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public with sharing class MetadataMapperFactory {

  public static MetadataMapperDefault getMapper(MetadataMapperType mt) {
    MetadataMapperDefault mapper = null;
    if(mt == MetadataMapperType.ASIS) {
      mapper = new MetadataMapperDefault();
    }
    if(mt == MetadataMapperType.SIMPLE) {
      mapper = new MetadataMapperSimple();
    }
    else if(mt == MetadataMapperType.CUSTOM) {
      mapper = new MetadataMapperCustom();
    }
    return mapper;
  }

}


================================================
FILE: custom_md_loader/classes/MetadataMapperFactory.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMapperSimple.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

/**
 * Simple mapping between source and target object field.
 * This option is for use-cases where you have only one field in source/target.
 *
 * */
public with sharing class MetadataMapperSimple extends MetadataMapperDefault {

  private String csFieldName;
  private String mdtFieldName;

  public MetadataMapperSimple() {
    super();
  }

  /**
   * Maps the source fields with target fields.
   *
   * @param sFrom: source object, e.g. VAT_Settings__c.IsActive__c
   * @param sFrom: target object, e.g. VAT_Settings__mdt.Active__c
   * @param mapping: in this case, mapping is null
   * */
  public override MetadataMappingInfo mapper(String csName, String cmtName, String mapping) {
    fetchSourceMetadataAndRecords(csName, cmtName);
    mapSourceTarget();

    return mappingInfo;
  }

    /**
     * Fetches source object metadata and builds the mapping info
     */
  private void fetchSourceMetadataAndRecords(String csNameWithField, String mdtNameWithField) {
    try {
      List<String> srcFieldNames = new List<String>();
      Map<String,DescribeFieldResult> srcFieldResultMap = new Map<String, DescribeFieldResult>();

      String[] csArray = csNameWithField.split('\\.');
      String[] mdtArray = mdtNameWithField.split('\\.');

      mappingInfo.setCustomSettingName(csArray[0]);
      mappingInfo.setCustomMetadadataTypeName(mdtArray[0]);

      csFieldName = csArray[1];
      mdtFieldName = mdtArray[1];

      DescribeSObjectResult objDef = Schema.getGlobalDescribe().get(csArray[0]).getDescribe();
      Map<String, SObjectField> fields = objDef.fields.getMap();
      DescribeFieldResult fieldDesc = fields.get(csFieldName).getDescribe();
      srcFieldResultMap.put(csFieldName.toLowerCase(), fieldDesc);

      srcFieldNames.add(csFieldName);

      String selectClause = 'SELECT ' + csArray[1] + ' ,Name ';
      String query = selectClause + ' FROM ' + csArray[0] + ' LIMIT 50000';
      List<sObject> recordList = Database.query(query);

      mappingInfo.setSrcFieldNames(srcFieldNames);
      mappingInfo.setRecordList(recordList);
      mappingInfo.setSrcFieldResultMap(srcFieldResultMap);

    }
    catch (Exception e) {
      System.debug('MetadataMapperSimple.Error Message=' + e.getMessage());
      throw e;
    }
  }

  // TODO: Currently, this is not implemented (well defaulted to true), but I think
  // we should implement to validate the fields that are not supported by Custom Metadata Types.

  /**
   * Validate the fields between source and target object.
   * e.g. If source Custom Object is having a field of type 'masterdetail',
   * then we should flag it an error or warning?
   *
   * */
  public override boolean validate(){
    return true;
  }

  public override void mapSourceTarget() {
    Map<String, String> csToMDT_fieldMapping = mappingInfo.getCSToMDT_fieldMapping();
    csToMDT_fieldMapping.put(csFieldName, mdtFieldName);
  }

}


================================================
FILE: custom_md_loader/classes/MetadataMapperSimple.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMapperType.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public enum MetadataMapperType { ASIS, SIMPLE, CUSTOM }


================================================
FILE: custom_md_loader/classes/MetadataMapperType.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMappingInfo.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public with sharing class MetadataMappingInfo {

  private final Set<String> standardFields = new Set<String>();
  private String customSettingName;
  private String customMetadadataTypeName;

  private List<String> srcFieldNames;
  private List<sObject> recordList;
  private Map<String, Schema.DescribeFieldResult> srcFieldResultMap;

  private Map<String, String> csToMDT_fieldMapping = new Map<String, String>();

  public MetadataMappingInfo() {
    standardFields.add(AppConstants.DEV_NAME_ATTRIBUTE);
    standardFields.add(AppConstants.LABEL_ATTRIBUTE);
    standardFields.add(AppConstants.DESC_ATTRIBUTE);
  }

  public Set<String> getStandardFields() {
    return standardFields;
  }

  public List<String> getSrcFieldNames() {
    return srcFieldNames;
  }

  public List<sObject> getRecordList() {
    return recordList;
  }

  public void setSrcFieldNames(List<String> names) {
    this.srcFieldNames = names;
  }

  public void setRecordList(List<sObject> records) {
    this.recordList = records;
  }

  public Map<String, String> getCSToMDT_fieldMapping() {
    return this.csToMDT_fieldMapping;
  }

  public void setCSToMDT_fieldMapping(Map<String, String> csToMDT_fieldMapping) {
    this.csToMDT_fieldMapping = csToMDT_fieldMapping;
  }

  public String getCustomSettingName() {
    return this.customSettingName;
  }

  public void setCustomSettingName(String customSettingName) {
    this.customSettingName = customSettingName;
  }

  public String getCustomMetadadataTypeName() {
    return this.customMetadadataTypeName;
  }

  public void setCustomMetadadataTypeName(String customMetadadataTypeName) {
    this.customMetadadataTypeName = customMetadadataTypeName;
  }

  public Map<String, Schema.DescribeFieldResult> getSrcFieldResultMap() {
    return this.srcFieldResultMap;
  }

  public void setSrcFieldResultMap(Map<String, Schema.DescribeFieldResult> fieldResult) {
    this.srcFieldResultMap = fieldResult;
  }

}


================================================
FILE: custom_md_loader/classes/MetadataMappingInfo.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMigrationController.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public class MetadataMigrationController {
  static MetadataService.MetadataPort service = MetadataUtil.getPort();

  private final Set<String> standardFieldsInHeader = new Set<String>();
  private List<String> nonSortedApiNames;

  public boolean showRecordsTable{get;set;}
  public String selectedType{get;set;}
  public Blob csvFileBody{get;set;}
  public SObject[] records{get;set;}
  public List<SelectOption> cmdTypes{public get;set;}
  public String selectedOpTypeAsIs{get;set;}
  public String selectedOpTypeSimple{get;set;}
  public String selectedOpTypeCustom{get;set;}
  public List<SelectOption> opTypes{public get;set;}
  public List<SelectOption> objCreationOpTypes{public get;set;}

  public List<String> fieldNamesForDisplay{public get;set;}

  public String customSettingFromFieldAsIs{public get;set;}
  public String customSettingFromFieldSimple{public get;set;}
  public String cmdToFieldSimple{public get;set;}
  public String customSettingFromFieldJson{public get;set;}
  public String cmdToFieldJson{public get;set;}

  public String csFieldObjCreation {public get;set;}
  public String cmtFieldObjCreation {public get;set;}
  public String opTypeFieldObjCreation {public get;set;}

  public String csNameApexMetadata{public get;set;}
  public String cmdNameApexMetadata{public get;set;}
  public String jsonMappingApexMetadata{public get;set;}

  public String jsonMapping{public get;set;}

  public boolean asyncDeployInProgress{get;set;}

  public boolean isMessage {get;set;}

  public MetadataOpType opType = MetadataOpType.APEXWRAPPER;
  //public MetadataOpType opType = MetadataOpType.METADATAAPEX;

  public MetadataMigrationController() {

    service.timeout_x = 40000;

    isMessage = false;
    asyncDeployInProgress = false;

    showRecordsTable = false;
    loadCustomMetadataMetadata();

    //No full name here since we don't want to allow that in the csv header. It is a generated field using type dev name and record dev name/label.
    standardFieldsInHeader.add(AppConstants.DEV_NAME_ATTRIBUTE);
    standardFieldsInHeader.add(AppConstants.LABEL_ATTRIBUTE);
    standardFieldsInHeader.add(AppConstants.DESC_ATTRIBUTE);

    opTypes = new List<SelectOption>();
    opTypes.add(new SelectOption(MetadataOpType.APEXWRAPPER.name(), 'Sync Operation'));
    opTypes.add(new SelectOption(MetadataOpType.METADATAAPEX.name(), 'Async Operation'));

    objCreationOpTypes = new List<SelectOption>();
    objCreationOpTypes.add(new SelectOption(MetadataOpType.APEXWRAPPER.name(), 'Sync Operation'));

  }

  /**
   * Queries to find all custom metadata types in the org and make it available to the VF page as drop down
   */
  private void loadCustomMetadataMetadata(){
    List<SObject> entityDefinitions =[select QualifiedApiName from EntityDefinition where IsCustomizable =true];
    for(SObject entityDefinition : entityDefinitions){
      String entityQualifiedApiName = (String)entityDefinition.get(AppConstants.QUALIFIED_API_NAME_ATTRIBUTE);
      if(entityQualifiedApiName.endsWith(AppConstants.MDT_SUFFIX)) {
        if(cmdTypes == null) {
          cmdTypes = new List<SelectOption>();
          cmdTypes.add(new SelectOption(AppConstants.SELECT_STRING, AppConstants.SELECT_STRING));
        }
        cmdTypes.add(new SelectOption(entityQualifiedApiName, entityQualifiedApiName));
      }
    }
  }

  private void init(String selectedOpType) {
    opType = MetadataOpType.APEXWRAPPER;
    if(selectedOpType == MetadataOpType.METADATAAPEX.name()) {
      opType = MetadataOpType.METADATAAPEX;
    }
  }

  public PageReference migrateAsIsWithObjCreation() {
    init(opTypeFieldObjCreation);

    MetadataLoader loader = MetadataLoaderFactory.getLoader(opType);
    loader.migrateAsIsWithObjCreation(csFieldObjCreation, cmtFieldObjCreation);

    MetadataResponse response = loader.getMetadataResponse();

    if(response.isSuccess()) {
      List<MetadataResponse.Message> messages = response.getMessages();
      for(MetadataResponse.Message message: messages) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, message.messageDetail);
        ApexPages.addMessage(msg);
      }
      isMessage = true;
    }
    else {
      List<MetadataResponse.Message> messages = response.getMessages();
      for(MetadataResponse.Message message: messages) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, message.messageDetail);
        ApexPages.addMessage(msg);
      }
      isMessage = true;
    }

    return null;
  }

  public PageReference migrateAsIsMapping() {
    init(selectedOpTypeAsIs);

    MetadataLoader loader = MetadataLoaderFactory.getLoader(opType);
    loader.migrateAsIsMapping(customSettingFromFieldAsIs, selectedType);
    MetadataResponse response = loader.getMetadataResponse();

    if(response.isSuccess()) {
      List<MetadataResponse.Message> messages = response.getMessages();
      for(MetadataResponse.Message message: messages) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, message.messageDetail);
        ApexPages.addMessage(msg);
      }
      isMessage = true;
    }
    else {
      List<MetadataResponse.Message> messages = response.getMessages();
      for(MetadataResponse.Message message: messages) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, message.messageDetail);
        ApexPages.addMessage(msg);
      }
      isMessage = true;
    }

    return null;
  }

  public PageReference migrateSimpleMapping() {
    init(selectedOpTypeSimple);
    MetadataLoader loader = MetadataLoaderFactory.getLoader(opType);
    loader.migrateSimpleMapping(customSettingFromFieldSimple, cmdToFieldSimple);
    MetadataResponse response = loader.getMetadataResponse();
    if(response.isSuccess()) {
      List<MetadataResponse.Message> messages = response.getMessages();
      for(MetadataResponse.Message message: messages) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, message.messageDetail);
        ApexPages.addMessage(msg);
      }
      isMessage = true;
    }
    else{
      List<MetadataResponse.Message> messages = response.getMessages();
      for(MetadataResponse.Message message: messages) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, message.messageDetail);
        ApexPages.addMessage(msg);
      }
      isMessage = true;
    }

    return null;
  }

  public PageReference migrateCustomMapping() {
    init(selectedOpTypeCustom);
    MetadataLoader loader = MetadataLoaderFactory.getLoader(opType);
    loader.migrateCustomMapping(customSettingFromFieldJson, cmdToFieldJson, jsonMapping);
    MetadataResponse response = loader.getMetadataResponse();
    List<MetadataResponse.Message> messages = response.getMessages();

    if(response.isSuccess()) {
      for(MetadataResponse.Message message: messages) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, message.messageDetail);
        ApexPages.addMessage(msg);
      }
      isMessage = true;
    }
    else {
      for(MetadataResponse.Message message: messages) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, message.messageDetail);
        ApexPages.addMessage(msg);
      }
      isMessage = true;
    }

    return null;
  }

}


================================================
FILE: custom_md_loader/classes/MetadataMigrationController.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>34.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataMigrationException.cls
================================================
/**
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public class MetadataMigrationException extends Exception{}


================================================
FILE: custom_md_loader/classes/MetadataMigrationException.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>40.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataObjectCreator.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
public with sharing class MetadataObjectCreator {

  private static MetadataService.MetadataPort service = MetadataUtil.getPort();
  // Supported data types during migration. If source custom setting or
  // source custom object has extra data types than below map, it will
  // not work. You can always use custom mapping approach in that case.
  public static final Map<DisplayType, String> displayTypeToTypeMap =
      new Map<DisplayType, String>{
        DisplayType.Boolean => 'Checkbox',
        DisplayType.Date => 'Date',
        DisplayType.DateTime => 'DateTime',
        DisplayType.Double => 'Number',
        DisplayType.Email => 'Email',
        DisplayType.EncryptedString => 'Text',
        DisplayType.Integer => 'Number',
        DisplayType.Percent => 'Number',
        DisplayType.Phone => 'Phone',
        DisplayType.Picklist => 'Picklist',
        DisplayType.String => 'Text',
        DisplayType.TextArea => 'TextArea',
        DisplayType.URL => 'Url'};

  public static void createCustomObject(MetadataMappingInfo mappingInfo) {
    try {
      String fullName = mappingInfo.getCustomMetadadataTypeName();

      String strippedLabel = fullName.replaceAll('\\W+', '_').replaceAll('__+', '_').replaceAll('\\A[^a-zA-Z]+', '').replaceAll('_$', '');

      String pluralLabel = fullName.subString(0, fullName.indexOf(AppConstants.MDT_SUFFIX));
      String label = pluralLabel;
      pluralLabel = pluralLabel + 's';

      MetadataService.CustomObject customObject = new MetadataService.CustomObject();
      customObject.fullName = fullName;
      customObject.label = label;
      customObject.pluralLabel = pluralLabel;
      List<MetadataService.SaveResult> results =
          service.createMetadata(
              new MetadataService.Metadata[] { customObject });
      handleSaveResults(results[0]);

    }
    catch (Exception e) {
      System.debug('createCustomObject.Exception-->' + e.getMessage());
      throw e;
    }
  }

  public static void createCustomField(MetadataMappingInfo mappingInfo) {
    try {
      String fullName = mappingInfo.getCustomMetadadataTypeName();

      String strippedLabel = fullName.replaceAll('\\W+', '_').replaceAll('__+', '_').replaceAll('\\A[^a-zA-Z]+', '').replaceAll('_$', '');

      String fieldFullName 	= '';
      String label 			= '';
      String type_x 			= '';

      Map<String, Schema.DescribeFieldResult> descFieldResultMap = mappingInfo.getSrcFieldResultMap();

      List<MetadataService.CustomField> customFields = new List<MetadataService.CustomField>();
      integer counter = 0;
      for(String csField : mappingInfo.getCSToMDT_fieldMapping().keySet()) {
        if(mappingInfo.getCSToMDT_fieldMapping().get(csField).endsWith('__c')){

          Schema.DescribeFieldResult descFieldResult = descFieldResultMap.get(csField.toLowerCase());
          String cmtField = mappingInfo.getCSToMDT_fieldMapping().get(csField);
          fieldFullName = fullName + '.' + cmtField;
          label = descFieldResult.getLabel();
          type_x = displayTypeToTypeMap.get(descFieldResult.getType());

          MetadataService.CustomField customField = new MetadataService.CustomField();
          customFields.add(customField);
          customField.fullName = fieldFullName;
          customField.label = label;
          customField.type_x = type_x;

          // Field datatype specifics
          if(type_x == 'Number' || type_x == 'Percent') {
            customField.precision = descFieldResult.getPrecision();
            customField.scale = descFieldResult.getScale();
          }
          if(type_x == 'Checkbox') {
            customField.defaultValue =
                descFieldResult.getDefaultValue() == null ? 'false' : String.valueOf(descFieldResult.getDefaultValue());
          }

          boolean lengthReq = true;
          if(descFieldResult.getLength() == 0
              || type_x == 'Email' || type_x == 'Phone'
              || type_x == 'URL' || type_x == 'Url'
              || type_x == 'TextArea' || type_x == 'Picklist') {
            lengthReq = false;
          }
          if(lengthReq && descFieldResult.getLength() != 0 ) {
            customField.length = descFieldResult.getLength();
          }
          if(type_x == 'Picklist') {
            customField.type_x = 'Picklist';
            Metadataservice.Picklist pt = new Metadataservice.Picklist();
            pt.sorted = false;
            List<MetadataService.PicklistValue> picklistValues = new List<MetadataService.PicklistValue>();
            for(Schema.PicklistEntry entry : descFieldResult.getPicklistValues()) {
              Metadataservice.PicklistValue picklistValue = new Metadataservice.PicklistValue();
              picklistValue.fullName = entry.getLabel();
              picklistValue.default_x = entry.isDefaultValue();
              picklistValues.add(picklistValue);
            }
            pt.picklistValues = picklistValues;
            customField.picklist = pt;
          }
          // process as batches of 10
          if(counter == 9) {
            List<MetadataService.SaveResult> results =
                service.createMetadata(customFields);
            handleSaveResults(results[0]);
            customFields.clear();
          }
          counter++;
        }
      }
      if(customFields.size() > 0) {
        List<MetadataService.SaveResult> results =
            service.createMetadata(customFields);
        handleSaveResults(results[0]);
        customFields.clear();
      }
    }
    catch (Exception e) {
      System.debug('createCustomField.Exception-->' + e.getMessage());
      throw e;
    }
  }

  /**
   * Example helper method to interpret a SaveResult, throws an exception if errors are found
   **/
  private static void handleSaveResults(MetadataService.SaveResult saveResult) {
    // Nothing to see?
    if(saveResult==null || saveResult.success)
      return;
    // Construct error message and throw an exception
    if(saveResult.errors!=null) {
      List<String> messages = new List<String>();
      messages.add(
          (saveResult.errors.size()==1 ? 'Error ' : 'Errors ') +
          'occurred processing component ' + saveResult.fullName + '.');
      for(MetadataService.Error error : saveResult.errors)
        messages.add(
            error.message + ' (' + error.statusCode + ').' +
            ( error.fields!=null && error.fields.size()>0 ?
                ' Fields ' + String.join(error.fields, ',') + '.' : '' ) );
      if(messages.size()>0)
        throw new MetadataMigrationException(String.join(messages, ' '));
    }
    if(!saveResult.success)
      throw new MetadataMigrationException(Label.ERROR_REQUEST_FAILED_NO_ERROR);
  }

}


================================================
FILE: custom_md_loader/classes/MetadataObjectCreator.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataOpType.cls
================================================
/* 
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */
 
public enum MetadataOpType { APEXWRAPPER, METADATAAPEX }


================================================
FILE: custom_md_loader/classes/MetadataOpType.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataResponse.cls
================================================
/*
 * Copyright (c) 2016, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

public with sharing class MetadataResponse {

  private boolean isSuccess;
  private List<Message> messages;
  private MetadataMappingInfo mappingInfo;

  public MetadataResponse() {
  }

  public MetadataResponse(boolean bIsSuccess, MetadataMappingInfo info, List<MetadataResponse.Message> messagesList) {
    this.isSuccess = bIsSuccess;
    this.messages = messagesList;
    this.mappingInfo = info;
  }

  public boolean isSuccess() {
    return this.isSuccess;
  }

  public void setIsSuccess(boolean isSuccess) {
    this.isSuccess = isSuccess;
  }

  public void setMappingInfo(MetadataMappingInfo info) {
    this.mappingInfo = info;
  }
  public MetadataMappingInfo getMappingInfo() {
    return this.mappingInfo;
  }

  public List<Message> getMessages() {
    return this.messages;
  }

  public void setMessages(List<Message> msg) {
    this.messages = msg;
  }

  public with sharing class Message {
    public Integer messageCode;
    public String messageDetail;

    public Message() {
    }

    public Message(Integer code, String message) {
      this.messageCode = code;
      this.messageDetail = message;
    }
  }

  public String debug() {
    return 'MetadataResponse{' + 'success=' + isSuccess() + ', messages=' + getMessages() + ', mapping info=' + getMappingInfo() + '}';
  }
}


================================================
FILE: custom_md_loader/classes/MetadataResponse.cls-meta.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
	<apiVersion>39.0</apiVersion>
	<status>Active</status>
</ApexClass>


================================================
FILE: custom_md_loader/classes/MetadataService.cls
================================================
/**
 * Copyright (c), FinancialForce.com, inc
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 *   are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 *      this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright notice,
 *      this list of conditions and the following disclaimer in the documentation
 *      and/or other materials provided with the distribution.
 * - Neither the name of the FinancialForce.com, inc nor the names of its contributors
 *      may be used to endorse or promote products derived from this software without
 *      specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 *  THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 *  OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/

//Generated by wsdl2apex

public class MetadataService {
    public class listMetadataResponse_element {
        public MetadataService.FileProperties[] result;
        private String[] result_type_info = new String[]{'result','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'result'};
    }
    public class WorkflowRule extends Metadata {
        public String type = 'WorkflowRule';
        public String fullName;
        public MetadataService.WorkflowActionReference[] actions;
        public Boolean active;
        public String booleanFilter;
        public MetadataService.FilterItem[] criteriaItems;
        public String description;
        public String formula;
        public String triggerType;
        public MetadataService.WorkflowTimeTrigger[] workflowTimeTriggers;
        private String[] actions_type_info = new String[]{'actions','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] active_type_info = new String[]{'active','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] booleanFilter_type_info = new String[]{'booleanFilter','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] criteriaItems_type_info = new String[]{'criteriaItems','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] formula_type_info = new String[]{'formula','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] triggerType_type_info = new String[]{'triggerType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] workflowTimeTriggers_type_info = new String[]{'workflowTimeTriggers','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'actions','active','booleanFilter','criteriaItems','description','formula','triggerType','workflowTimeTriggers'};
    }
    public class FieldOverride {
        public String field;
        public String formula;
        public String literalValue;
        private String[] field_type_info = new String[]{'field','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] formula_type_info = new String[]{'formula','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] literalValue_type_info = new String[]{'literalValue','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'field','formula','literalValue'};
    }
    public class AccountOwnerSharingRule {
        public String accountAccessLevel;
        public String caseAccessLevel;
        public String contactAccessLevel;
        public String description;
        public String name;
        public String opportunityAccessLevel;
        private String[] accountAccessLevel_type_info = new String[]{'accountAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] caseAccessLevel_type_info = new String[]{'caseAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] contactAccessLevel_type_info = new String[]{'contactAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] opportunityAccessLevel_type_info = new String[]{'opportunityAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'accountAccessLevel','caseAccessLevel','contactAccessLevel','description','name','opportunityAccessLevel'};
    }
    public class QuotasSettings {
        public Boolean showQuotas;
        private String[] showQuotas_type_info = new String[]{'showQuotas','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'showQuotas'};
    }
    public class checkDeployStatus_element {
        public String asyncProcessId;
        public Boolean includeDetails;
        private String[] asyncProcessId_type_info = new String[]{'asyncProcessId','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] includeDetails_type_info = new String[]{'includeDetails','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'asyncProcessId','includeDetails'};
    }
    public class Skill extends Metadata {
        public String type = 'Skill';
        public String fullName;
        public MetadataService.SkillAssignments assignments;
        public String label;
        private String[] assignments_type_info = new String[]{'assignments','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] label_type_info = new String[]{'label','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'assignments','label'};
    }
    public class CodeCoverageWarning {
        public String id;
        public String message;
        public String name;
        public String namespace;
        private String[] id_type_info = new String[]{'id','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] message_type_info = new String[]{'message','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','true'};
        private String[] namespace_type_info = new String[]{'namespace','http://soap.sforce.com/2006/04/metadata',null,'1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'id','message','name','namespace'};
    }
    public class FlowInputValidationRule {
        public String errorMessage;
        public String formulaExpression;
        private String[] errorMessage_type_info = new String[]{'errorMessage','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] formulaExpression_type_info = new String[]{'formulaExpression','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'errorMessage','formulaExpression'};
    }
    public class FlowApexPluginCall {
        public String apexClass;
        public MetadataService.FlowConnector connector;
        public MetadataService.FlowConnector faultConnector;
        public MetadataService.FlowApexPluginCallInputParameter[] inputParameters;
        public MetadataService.FlowApexPluginCallOutputParameter[] outputParameters;
        private String[] apexClass_type_info = new String[]{'apexClass','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] connector_type_info = new String[]{'connector','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] faultConnector_type_info = new String[]{'faultConnector','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] inputParameters_type_info = new String[]{'inputParameters','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] outputParameters_type_info = new String[]{'outputParameters','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'apexClass','connector','faultConnector','inputParameters','outputParameters'};
    }
    public class CustomObjectCriteriaBasedSharingRule {
        public String accessLevel;
        public String booleanFilter;
        public String description;
        public String name;
        private String[] accessLevel_type_info = new String[]{'accessLevel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] booleanFilter_type_info = new String[]{'booleanFilter','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'accessLevel','booleanFilter','description','name'};
    }
    public class KnowledgeAnswerSettings {
        public String assignTo;
        public String defaultArticleType;
        public Boolean enableArticleCreation;
        private String[] assignTo_type_info = new String[]{'assignTo','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] defaultArticleType_type_info = new String[]{'defaultArticleType','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableArticleCreation_type_info = new String[]{'enableArticleCreation','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'assignTo','defaultArticleType','enableArticleCreation'};
    }
    public class PasswordPolicies {
        public String apiOnlyUserHomePageURL;
        public String complexity;
        public String expiration;
        public String historyRestriction;
        public String lockoutInterval;
        public String maxLoginAttempts;
        public String minPasswordLength;
        public Boolean minimumPasswordLifetime;
        public Boolean obscureSecretAnswer;
        public String passwordAssistanceMessage;
        public String passwordAssistanceURL;
        public String questionRestriction;
        private String[] apiOnlyUserHomePageURL_type_info = new String[]{'apiOnlyUserHomePageURL','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] complexity_type_info = new String[]{'complexity','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] expiration_type_info = new String[]{'expiration','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] historyRestriction_type_info = new String[]{'historyRestriction','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] lockoutInterval_type_info = new String[]{'lockoutInterval','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] maxLoginAttempts_type_info = new String[]{'maxLoginAttempts','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] minPasswordLength_type_info = new String[]{'minPasswordLength','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] minimumPasswordLifetime_type_info = new String[]{'minimumPasswordLifetime','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] obscureSecretAnswer_type_info = new String[]{'obscureSecretAnswer','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] passwordAssistanceMessage_type_info = new String[]{'passwordAssistanceMessage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] passwordAssistanceURL_type_info = new String[]{'passwordAssistanceURL','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] questionRestriction_type_info = new String[]{'questionRestriction','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'apiOnlyUserHomePageURL','complexity','expiration','historyRestriction','lockoutInterval','maxLoginAttempts','minPasswordLength','minimumPasswordLifetime','obscureSecretAnswer','passwordAssistanceMessage','passwordAssistanceURL','questionRestriction'};
    }
    public class QueueSobject {
        public String sobjectType;
        private String[] sobjectType_type_info = new String[]{'sobjectType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'sobjectType'};
    }
    public class CaseSharingRules {
        public MetadataService.CaseCriteriaBasedSharingRule[] criteriaBasedRules;
        public MetadataService.CaseOwnerSharingRule[] ownerRules;
        private String[] criteriaBasedRules_type_info = new String[]{'criteriaBasedRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] ownerRules_type_info = new String[]{'ownerRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'criteriaBasedRules','ownerRules'};
    }
    public class AgentConfigProfileAssignments {
        public String[] profile;
        private String[] profile_type_info = new String[]{'profile','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'profile'};
    }
    public class OpportunityOwnerSharingRule {
        public String description;
        public String name;
        public String opportunityAccessLevel;
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] opportunityAccessLevel_type_info = new String[]{'opportunityAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'description','name','opportunityAccessLevel'};
    }
    public class ExternalDataSource extends Metadata {
        public String type = 'ExternalDataSource';
        public String fullName;
        public String apiKey;
        public String authProvider;
        public String certificate;
        public String customConfiguration;
        public String endpoint;
        public String label;
        public String oauthRefreshToken;
        public String oauthScope;
        public String oauthToken;
        public String password;
        public String principalType;
        public String protocol;
        public String repository;
        public String type_x;
        public String username;
        public String version;
        private String[] apiKey_type_info = new String[]{'apiKey','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] authProvider_type_info = new String[]{'authProvider','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] certificate_type_info = new String[]{'certificate','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] customConfiguration_type_info = new String[]{'customConfiguration','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] endpoint_type_info = new String[]{'endpoint','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] label_type_info = new String[]{'label','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] oauthRefreshToken_type_info = new String[]{'oauthRefreshToken','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] oauthScope_type_info = new String[]{'oauthScope','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] oauthToken_type_info = new String[]{'oauthToken','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] password_type_info = new String[]{'password','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] principalType_type_info = new String[]{'principalType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] protocol_type_info = new String[]{'protocol','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] repository_type_info = new String[]{'repository','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] type_x_type_info = new String[]{'type','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] username_type_info = new String[]{'username','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] version_type_info = new String[]{'version','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'apiKey','authProvider','certificate','customConfiguration','endpoint','label','oauthRefreshToken','oauthScope','oauthToken','password','principalType','protocol','repository','type_x','username','version'};
    }
    public class WorkflowEmailRecipient {
        public String field;
        public String recipient;
        public String type_x;
        private String[] field_type_info = new String[]{'field','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] recipient_type_info = new String[]{'recipient','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] type_x_type_info = new String[]{'type','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'field','recipient','type_x'};
    }
    public class DescribeMetadataResult {
        public MetadataService.DescribeMetadataObject[] metadataObjects;
        public String organizationNamespace;
        public Boolean partialSaveAllowed;
        public Boolean testRequired;
        private String[] metadataObjects_type_info = new String[]{'metadataObjects','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] organizationNamespace_type_info = new String[]{'organizationNamespace','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] partialSaveAllowed_type_info = new String[]{'partialSaveAllowed','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] testRequired_type_info = new String[]{'testRequired','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'metadataObjects','organizationNamespace','partialSaveAllowed','testRequired'};
    }
    public class Scontrol extends MetadataWithContent {
        public String type = 'Scontrol';
        public String fullName;
        public String content;
        public String contentSource;
        public String description;
        public String encodingKey;
        public String fileContent;
        public String fileName;
        public String name;
        public Boolean supportsCaching;
        private String[] contentSource_type_info = new String[]{'contentSource','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] encodingKey_type_info = new String[]{'encodingKey','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] fileContent_type_info = new String[]{'fileContent','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] fileName_type_info = new String[]{'fileName','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] supportsCaching_type_info = new String[]{'supportsCaching','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] content_type_info = new String[]{'content','http://www.w3.org/2001/XMLSchema','base64Binary','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'content', 'contentSource','description','encodingKey','fileContent','fileName','name','supportsCaching'};
    }
    public class DashboardComponent {
        public Boolean autoselectColumnsFromReport;
        public String chartAxisRange;
        public Double chartAxisRangeMax;
        public Double chartAxisRangeMin;
        public MetadataService.ChartSummary[] chartSummary;
        public String componentType;
        public MetadataService.DashboardFilterColumn[] dashboardFilterColumns;
        public MetadataService.DashboardTableColumn[] dashboardTableColumn;
        public String displayUnits;
        public String drillDownUrl;
        public Boolean drillEnabled;
        public Boolean drillToDetailEnabled;
        public Boolean enableHover;
        public Boolean expandOthers;
        public String footer;
        public Double gaugeMax;
        public Double gaugeMin;
        public String[] groupingColumn;
        public String header;
        public Double indicatorBreakpoint1;
        public Double indicatorBreakpoint2;
        public String indicatorHighColor;
        public String indicatorLowColor;
        public String indicatorMiddleColor;
        public String legendPosition;
        public Integer maxValuesDisplayed;
        public String metricLabel;
        public String page_x;
        public Integer pageHeightInPixels;
        public String report;
        public String scontrol;
        public Integer scontrolHeightInPixels;
        public Boolean showPercentage;
        public Boolean showPicturesOnCharts;
        public Boolean showPicturesOnTables;
        public Boolean showTotal;
        public Boolean showValues;
        public String sortBy;
        public String title;
        public Boolean useReportChart;
        private String[] autoselectColumnsFromReport_type_info = new String[]{'autoselectColumnsFromReport','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chartAxisRange_type_info = new String[]{'chartAxisRange','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chartAxisRangeMax_type_info = new String[]{'chartAxisRangeMax','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chartAxisRangeMin_type_info = new String[]{'chartAxisRangeMin','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chartSummary_type_info = new String[]{'chartSummary','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] componentType_type_info = new String[]{'componentType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] dashboardFilterColumns_type_info = new String[]{'dashboardFilterColumns','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] dashboardTableColumn_type_info = new String[]{'dashboardTableColumn','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] displayUnits_type_info = new String[]{'displayUnits','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] drillDownUrl_type_info = new String[]{'drillDownUrl','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] drillEnabled_type_info = new String[]{'drillEnabled','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] drillToDetailEnabled_type_info = new String[]{'drillToDetailEnabled','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableHover_type_info = new String[]{'enableHover','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] expandOthers_type_info = new String[]{'expandOthers','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] footer_type_info = new String[]{'footer','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] gaugeMax_type_info = new String[]{'gaugeMax','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] gaugeMin_type_info = new String[]{'gaugeMin','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] groupingColumn_type_info = new String[]{'groupingColumn','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] header_type_info = new String[]{'header','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] indicatorBreakpoint1_type_info = new String[]{'indicatorBreakpoint1','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] indicatorBreakpoint2_type_info = new String[]{'indicatorBreakpoint2','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] indicatorHighColor_type_info = new String[]{'indicatorHighColor','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] indicatorLowColor_type_info = new String[]{'indicatorLowColor','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] indicatorMiddleColor_type_info = new String[]{'indicatorMiddleColor','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] legendPosition_type_info = new String[]{'legendPosition','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] maxValuesDisplayed_type_info = new String[]{'maxValuesDisplayed','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] metricLabel_type_info = new String[]{'metricLabel','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] page_x_type_info = new String[]{'page','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] pageHeightInPixels_type_info = new String[]{'pageHeightInPixels','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] report_type_info = new String[]{'report','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] scontrol_type_info = new String[]{'scontrol','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] scontrolHeightInPixels_type_info = new String[]{'scontrolHeightInPixels','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showPercentage_type_info = new String[]{'showPercentage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showPicturesOnCharts_type_info = new String[]{'showPicturesOnCharts','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showPicturesOnTables_type_info = new String[]{'showPicturesOnTables','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showTotal_type_info = new String[]{'showTotal','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showValues_type_info = new String[]{'showValues','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] sortBy_type_info = new String[]{'sortBy','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] title_type_info = new String[]{'title','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] useReportChart_type_info = new String[]{'useReportChart','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'autoselectColumnsFromReport','chartAxisRange','chartAxisRangeMax','chartAxisRangeMin','chartSummary','componentType','dashboardFilterColumns','dashboardTableColumn','displayUnits','drillDownUrl','drillEnabled','drillToDetailEnabled','enableHover','expandOthers','footer','gaugeMax','gaugeMin','groupingColumn','header','indicatorBreakpoint1','indicatorBreakpoint2','indicatorHighColor','indicatorLowColor','indicatorMiddleColor','legendPosition','maxValuesDisplayed','metricLabel','page_x','pageHeightInPixels','report','scontrol','scontrolHeightInPixels','showPercentage','showPicturesOnCharts','showPicturesOnTables','showTotal','showValues','sortBy','title','useReportChart'};
    }
    public class WorkflowFlowActionParameter {
        public String name;
        public String value;
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] value_type_info = new String[]{'value','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'name','value'};
    }
    public class IdeasSettings extends Metadata {
        public String type = 'IdeasSettings';
        public String fullName;
        public Boolean enableChatterProfile;
        public Boolean enableIdeaThemes;
        public Boolean enableIdeas;
        public Boolean enableIdeasReputation;
        public Double halfLife;
        public String ideasProfilePage;
        private String[] enableChatterProfile_type_info = new String[]{'enableChatterProfile','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableIdeaThemes_type_info = new String[]{'enableIdeaThemes','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableIdeas_type_info = new String[]{'enableIdeas','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableIdeasReputation_type_info = new String[]{'enableIdeasReputation','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] halfLife_type_info = new String[]{'halfLife','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] ideasProfilePage_type_info = new String[]{'ideasProfilePage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'enableChatterProfile','enableIdeaThemes','enableIdeas','enableIdeasReputation','halfLife','ideasProfilePage'};
    }
    public class Country {
        public Boolean active;
        public String integrationValue;
        public String isoCode;
        public String label;
        public Boolean orgDefault;
        public Boolean standard;
        public MetadataService.State[] states;
        public Boolean visible;
        private String[] active_type_info = new String[]{'active','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] integrationValue_type_info = new String[]{'integrationValue','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] isoCode_type_info = new String[]{'isoCode','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] label_type_info = new String[]{'label','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] orgDefault_type_info = new String[]{'orgDefault','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] standard_type_info = new String[]{'standard','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] states_type_info = new String[]{'states','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] visible_type_info = new String[]{'visible','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'active','integrationValue','isoCode','label','orgDefault','standard','states','visible'};
    }
    public class ConnectedAppOauthConfig {
        public String callbackUrl;
        public String certificate;
        public String consumerKey;
        public String consumerSecret;
        public String[] scopes;
        private String[] callbackUrl_type_info = new String[]{'callbackUrl','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] certificate_type_info = new String[]{'certificate','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] consumerKey_type_info = new String[]{'consumerKey','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] consumerSecret_type_info = new String[]{'consumerSecret','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] scopes_type_info = new String[]{'scopes','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'callbackUrl','certificate','consumerKey','consumerSecret','scopes'};
    }
    public class LiveAgentSettings extends Metadata {
        public String type = 'LiveAgentSettings';
        public String fullName;
        public Boolean enableLiveAgent;
        private String[] enableLiveAgent_type_info = new String[]{'enableLiveAgent','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'enableLiveAgent'};
    }
    public class PermissionSetApexClassAccess {
        public String apexClass;
        public Boolean enabled;
        private String[] apexClass_type_info = new String[]{'apexClass','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] enabled_type_info = new String[]{'enabled','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'apexClass','enabled'};
    }
    public class LogInfo {
        public String category;
        public String level;
        private String[] category_type_info = new String[]{'category','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] level_type_info = new String[]{'level','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'category','level'};
    }
    public class SkillAssignments {
        public MetadataService.SkillProfileAssignments profiles;
        public MetadataService.SkillUserAssignments users;
        private String[] profiles_type_info = new String[]{'profiles','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] users_type_info = new String[]{'users','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'profiles','users'};
    }
    public class ReputationLevels {
        public MetadataService.ChatterAnswersReputationLevel[] chatterAnswersReputationLevels;
        public MetadataService.IdeaReputationLevel[] ideaReputationLevels;
        private String[] chatterAnswersReputationLevels_type_info = new String[]{'chatterAnswersReputationLevels','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] ideaReputationLevels_type_info = new String[]{'ideaReputationLevels','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'chatterAnswersReputationLevels','ideaReputationLevels'};
    }
    public class ActivitiesSettings extends Metadata {
        public String type = 'ActivitiesSettings';
        public String fullName;
        public Boolean allowUsersToRelateMultipleContactsToTasksAndEvents;
        public Boolean enableActivityReminders;
        public Boolean enableClickCreateEvents;
        public Boolean enableDragAndDropScheduling;
        public Boolean enableEmailTracking;
        public Boolean enableEventScheduler;
        public Boolean enableGroupTasks;
        public Boolean enableListViewScheduling;
        public Boolean enableLogNote;
        public Boolean enableMultidayEvents;
        public Boolean enableRecurringEvents;
        public Boolean enableRecurringTasks;
        public Boolean enableSidebarCalendarShortcut;
        public Boolean enableSimpleTaskCreateUI;
        public Boolean enableUNSTaskDelegatedToNotifications;
        public String meetingRequestsLogo;
        public Boolean showCustomLogoMeetingRequests;
        public Boolean showEventDetailsMultiUserCalendar;
        public Boolean showHomePageHoverLinksForEvents;
        public Boolean showMyTasksHoverLinks;
        public Boolean showRequestedMeetingsOnHomePage;
        private String[] allowUsersToRelateMultipleContactsToTasksAndEvents_type_info = new String[]{'allowUsersToRelateMultipleContactsToTasksAndEvents','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableActivityReminders_type_info = new String[]{'enableActivityReminders','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableClickCreateEvents_type_info = new String[]{'enableClickCreateEvents','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableDragAndDropScheduling_type_info = new String[]{'enableDragAndDropScheduling','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableEmailTracking_type_info = new String[]{'enableEmailTracking','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableEventScheduler_type_info = new String[]{'enableEventScheduler','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableGroupTasks_type_info = new String[]{'enableGroupTasks','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableListViewScheduling_type_info = new String[]{'enableListViewScheduling','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableLogNote_type_info = new String[]{'enableLogNote','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableMultidayEvents_type_info = new String[]{'enableMultidayEvents','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableRecurringEvents_type_info = new String[]{'enableRecurringEvents','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableRecurringTasks_type_info = new String[]{'enableRecurringTasks','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableSidebarCalendarShortcut_type_info = new String[]{'enableSidebarCalendarShortcut','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableSimpleTaskCreateUI_type_info = new String[]{'enableSimpleTaskCreateUI','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] enableUNSTaskDelegatedToNotifications_type_info = new String[]{'enableUNSTaskDelegatedToNotifications','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] meetingRequestsLogo_type_info = new String[]{'meetingRequestsLogo','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showCustomLogoMeetingRequests_type_info = new String[]{'showCustomLogoMeetingRequests','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showEventDetailsMultiUserCalendar_type_info = new String[]{'showEventDetailsMultiUserCalendar','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showHomePageHoverLinksForEvents_type_info = new String[]{'showHomePageHoverLinksForEvents','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showMyTasksHoverLinks_type_info = new String[]{'showMyTasksHoverLinks','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showRequestedMeetingsOnHomePage_type_info = new String[]{'showRequestedMeetingsOnHomePage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'allowUsersToRelateMultipleContactsToTasksAndEvents','enableActivityReminders','enableClickCreateEvents','enableDragAndDropScheduling','enableEmailTracking','enableEventScheduler','enableGroupTasks','enableListViewScheduling','enableLogNote','enableMultidayEvents','enableRecurringEvents','enableRecurringTasks','enableSidebarCalendarShortcut','enableSimpleTaskCreateUI','enableUNSTaskDelegatedToNotifications','meetingRequestsLogo','showCustomLogoMeetingRequests','showEventDetailsMultiUserCalendar','showHomePageHoverLinksForEvents','showMyTasksHoverLinks','showRequestedMeetingsOnHomePage'};
    }
    public class WorkflowTaskTranslation {
        public String description;
        public String name;
        public String subject;
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] subject_type_info = new String[]{'subject','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'description','name','subject'};
    }
    public class FlowElement {
        public String description;
        public String name;
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'description','name'};
    }
    public class FlowInputFieldAssignment {
        public String field;
        public MetadataService.FlowElementReferenceOrValue value;
        private String[] field_type_info = new String[]{'field','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] value_type_info = new String[]{'value','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'field','value'};
    }
    public class DashboardComponentSection {
        public String columnSize;
        public MetadataService.DashboardComponent[] components;
        private String[] columnSize_type_info = new String[]{'columnSize','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] components_type_info = new String[]{'components','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'columnSize','components'};
    }
    public class FlowLoop {
        public String assignNextValueToReference;
        public String collectionReference;
        public String iterationOrder;
        public MetadataService.FlowConnector nextValueConnector;
        public MetadataService.FlowConnector noMoreValuesConnector;
        private String[] assignNextValueToReference_type_info = new String[]{'assignNextValueToReference','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] collectionReference_type_info = new String[]{'collectionReference','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] iterationOrder_type_info = new String[]{'iterationOrder','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] nextValueConnector_type_info = new String[]{'nextValueConnector','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] noMoreValuesConnector_type_info = new String[]{'noMoreValuesConnector','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'assignNextValueToReference','collectionReference','iterationOrder','nextValueConnector','noMoreValuesConnector'};
    }
    public class ReputationPointsRule {
        public String eventType;
        public Integer points;
        private String[] eventType_type_info = new String[]{'eventType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] points_type_info = new String[]{'points','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'eventType','points'};
    }
    public class FlowActionCallInputParameter {
        public String name;
        public MetadataService.FlowElementReferenceOrValue value;
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] value_type_info = new String[]{'value','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'name','value'};
    }
    public class ReportTypeColumn {
        public Boolean checkedByDefault;
        public String displayNameOverride;
        public String field;
        public String table;
        private String[] checkedByDefault_type_info = new String[]{'checkedByDefault','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] displayNameOverride_type_info = new String[]{'displayNameOverride','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] field_type_info = new String[]{'field','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] table_type_info = new String[]{'table','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'checkedByDefault','displayNameOverride','field','table'};
    }
    public class LiveAgentConfig {
        public Boolean enableLiveChat;
        public Boolean openNewAccountSubtab;
        public Boolean openNewCaseSubtab;
        public Boolean openNewContactSubtab;
        public Boolean openNewLeadSubtab;
        public Boolean openNewVFPageSubtab;
        public MetadataService.PagesToOpen pagesToOpen;
        public Boolean showKnowledgeArticles;
        private String[] enableLiveChat_type_info = new String[]{'enableLiveChat','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] openNewAccountSubtab_type_info = new String[]{'openNewAccountSubtab','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] openNewCaseSubtab_type_info = new String[]{'openNewCaseSubtab','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] openNewContactSubtab_type_info = new String[]{'openNewContactSubtab','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] openNewLeadSubtab_type_info = new String[]{'openNewLeadSubtab','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] openNewVFPageSubtab_type_info = new String[]{'openNewVFPageSubtab','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] pagesToOpen_type_info = new String[]{'pagesToOpen','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showKnowledgeArticles_type_info = new String[]{'showKnowledgeArticles','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'enableLiveChat','openNewAccountSubtab','openNewCaseSubtab','openNewContactSubtab','openNewLeadSubtab','openNewVFPageSubtab','pagesToOpen','showKnowledgeArticles'};
    }
    public class KnowledgeSitesSettings {
        public String[] site;
        private String[] site_type_info = new String[]{'site','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'site'};
    }
    public class UserSharingRules {
        public MetadataService.UserCriteriaBasedSharingRule[] criteriaBasedRules;
        public MetadataService.UserMembershipSharingRule[] membershipRules;
        private String[] criteriaBasedRules_type_info = new String[]{'criteriaBasedRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] membershipRules_type_info = new String[]{'membershipRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'criteriaBasedRules','membershipRules'};
    }
    public class CustomMetadata extends Metadata {
        public String type = 'CustomMetadata';
        public String fullName;
        public String description;
        public String label;
        public MetadataService.CustomMetadataValue[] values;
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] label_type_info = new String[]{'label','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] values_type_info = new String[]{'values','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'description','label','values'};
    }
    public class VisualizationPlugin extends Metadata {
        public String type = 'VisualizationPlugin';
        public String fullName;
        public String description;
        public String developerName;
        public String icon;
        public String masterLabel;
        public MetadataService.VisualizationResource[] visualizationResources;
        public MetadataService.VisualizationType[] visualizationTypes;
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] developerName_type_info = new String[]{'developerName','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] icon_type_info = new String[]{'icon','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] masterLabel_type_info = new String[]{'masterLabel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] visualizationResources_type_info = new String[]{'visualizationResources','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] visualizationTypes_type_info = new String[]{'visualizationTypes','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'description','developerName','icon','masterLabel','visualizationResources','visualizationTypes'};
    }
    public class ApprovalPageField {
        public String[] field;
        private String[] field_type_info = new String[]{'field','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'field'};
    }
    public class FlowRule {
        public String conditionLogic;
        public MetadataService.FlowCondition[] conditions;
        public MetadataService.FlowConnector connector;
        public String label;
        private String[] conditionLogic_type_info = new String[]{'conditionLogic','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] conditions_type_info = new String[]{'conditions','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] connector_type_info = new String[]{'connector','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] label_type_info = new String[]{'label','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'conditionLogic','conditions','connector','label'};
    }
    public class FlowRecordUpdate {
        public MetadataService.FlowConnector connector;
        public MetadataService.FlowConnector faultConnector;
        public MetadataService.FlowRecordFilter[] filters;
        public MetadataService.FlowInputFieldAssignment[] inputAssignments;
        public String inputReference;
        public String object_x;
        private String[] connector_type_info = new String[]{'connector','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] faultConnector_type_info = new String[]{'faultConnector','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] filters_type_info = new String[]{'filters','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] inputAssignments_type_info = new String[]{'inputAssignments','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] inputReference_type_info = new String[]{'inputReference','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] object_x_type_info = new String[]{'object','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'connector','faultConnector','filters','inputAssignments','inputReference','object_x'};
    }
    public class CustomSite extends Metadata {
        public String type = 'CustomSite';
        public String fullName;
        public Boolean active;
        public Boolean allowHomePage;
        public Boolean allowStandardAnswersPages;
        public Boolean allowStandardIdeasPages;
        public Boolean allowStandardLookups;
        public Boolean allowStandardSearch;
        public String analyticsTrackingCode;
        public String authorizationRequiredPage;
        public String bandwidthExceededPage;
        public String changePasswordPage;
        public String chatterAnswersForgotPasswordConfirmPage;
        public String chatterAnswersForgotPasswordPage;
        public String chatterAnswersHelpPage;
        public String chatterAnswersLoginPage;
        public String chatterAnswersRegistrationPage;
        public String clickjackProtectionLevel;
        public MetadataService.SiteWebAddress[] customWebAddresses;
        public String description;
        public String favoriteIcon;
        public String fileNotFoundPage;
        public String genericErrorPage;
        public String guestProfile;
        public String inMaintenancePage;
        public String inactiveIndexPage;
        public String indexPage;
        public String masterLabel;
        public String myProfilePage;
        public String portal;
        public Boolean requireHttps;
        public Boolean requireInsecurePortalAccess;
        public String robotsTxtPage;
        public String rootComponent;
        public String selfRegPage;
        public String serverIsDown;
        public String siteAdmin;
        public MetadataService.SiteRedirectMapping[] siteRedirectMappings;
        public String siteTemplate;
        public String siteType;
        public String subdomain;
        public String urlPathPrefix;
        private String[] active_type_info = new String[]{'active','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] allowHomePage_type_info = new String[]{'allowHomePage','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] allowStandardAnswersPages_type_info = new String[]{'allowStandardAnswersPages','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] allowStandardIdeasPages_type_info = new String[]{'allowStandardIdeasPages','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] allowStandardLookups_type_info = new String[]{'allowStandardLookups','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] allowStandardSearch_type_info = new String[]{'allowStandardSearch','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] analyticsTrackingCode_type_info = new String[]{'analyticsTrackingCode','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] authorizationRequiredPage_type_info = new String[]{'authorizationRequiredPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] bandwidthExceededPage_type_info = new String[]{'bandwidthExceededPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] changePasswordPage_type_info = new String[]{'changePasswordPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chatterAnswersForgotPasswordConfirmPage_type_info = new String[]{'chatterAnswersForgotPasswordConfirmPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chatterAnswersForgotPasswordPage_type_info = new String[]{'chatterAnswersForgotPasswordPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chatterAnswersHelpPage_type_info = new String[]{'chatterAnswersHelpPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chatterAnswersLoginPage_type_info = new String[]{'chatterAnswersLoginPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] chatterAnswersRegistrationPage_type_info = new String[]{'chatterAnswersRegistrationPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] clickjackProtectionLevel_type_info = new String[]{'clickjackProtectionLevel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] customWebAddresses_type_info = new String[]{'customWebAddresses','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] favoriteIcon_type_info = new String[]{'favoriteIcon','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] fileNotFoundPage_type_info = new String[]{'fileNotFoundPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] genericErrorPage_type_info = new String[]{'genericErrorPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] guestProfile_type_info = new String[]{'guestProfile','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] inMaintenancePage_type_info = new String[]{'inMaintenancePage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] inactiveIndexPage_type_info = new String[]{'inactiveIndexPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] indexPage_type_info = new String[]{'indexPage','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] masterLabel_type_info = new String[]{'masterLabel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] myProfilePage_type_info = new String[]{'myProfilePage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] portal_type_info = new String[]{'portal','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] requireHttps_type_info = new String[]{'requireHttps','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] requireInsecurePortalAccess_type_info = new String[]{'requireInsecurePortalAccess','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] robotsTxtPage_type_info = new String[]{'robotsTxtPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] rootComponent_type_info = new String[]{'rootComponent','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] selfRegPage_type_info = new String[]{'selfRegPage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] serverIsDown_type_info = new String[]{'serverIsDown','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] siteAdmin_type_info = new String[]{'siteAdmin','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] siteRedirectMappings_type_info = new String[]{'siteRedirectMappings','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] siteTemplate_type_info = new String[]{'siteTemplate','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] siteType_type_info = new String[]{'siteType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] subdomain_type_info = new String[]{'subdomain','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] urlPathPrefix_type_info = new String[]{'urlPathPrefix','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'active','allowHomePage','allowStandardAnswersPages','allowStandardIdeasPages','allowStandardLookups','allowStandardSearch','analyticsTrackingCode','authorizationRequiredPage','bandwidthExceededPage','changePasswordPage','chatterAnswersForgotPasswordConfirmPage','chatterAnswersForgotPasswordPage','chatterAnswersHelpPage','chatterAnswersLoginPage','chatterAnswersRegistrationPage','clickjackProtectionLevel','customWebAddresses','description','favoriteIcon','fileNotFoundPage','genericErrorPage','guestProfile','inMaintenancePage','inactiveIndexPage','indexPage','masterLabel','myProfilePage','portal','requireHttps','requireInsecurePortalAccess','robotsTxtPage','rootComponent','selfRegPage','serverIsDown','siteAdmin','siteRedirectMappings','siteTemplate','siteType','subdomain','urlPathPrefix'};
    }
    public class ReportBlockInfo {
        public MetadataService.ReportAggregateReference[] aggregateReferences;
        public String blockId;
        public String joinTable;
        private String[] aggregateReferences_type_info = new String[]{'aggregateReferences','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] blockId_type_info = new String[]{'blockId','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] joinTable_type_info = new String[]{'joinTable','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'aggregateReferences','blockId','joinTable'};
    }
    public class describeMetadataResponse_element {
        public MetadataService.DescribeMetadataResult result;
        private String[] result_type_info = new String[]{'result','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'result'};
    }
    public class CaseOwnerSharingRule {
        public String caseAccessLevel;
        public String description;
        public String name;
        private String[] caseAccessLevel_type_info = new String[]{'caseAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'caseAccessLevel','description','name'};
    }
    public class DeployMessage {
        public Boolean changed;
        public Integer columnNumber;
        public String componentType;
        public Boolean created;
        public DateTime createdDate;
        public Boolean deleted;
        public String fileName;
        public String fullName;
        public String id;
        public Integer lineNumber;
        public String problem;
        public String problemType;
        public Boolean success;
        private String[] changed_type_info = new String[]{'changed','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] columnNumber_type_info = new String[]{'columnNumber','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] componentType_type_info = new String[]{'componentType','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] created_type_info = new String[]{'created','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] createdDate_type_info = new String[]{'createdDate','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] deleted_type_info = new String[]{'deleted','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] fileName_type_info = new String[]{'fileName','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] fullName_type_info = new String[]{'fullName','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] id_type_info = new String[]{'id','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] lineNumber_type_info = new String[]{'lineNumber','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] problem_type_info = new String[]{'problem','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] problemType_type_info = new String[]{'problemType','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] success_type_info = new String[]{'success','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'changed','columnNumber','componentType','created','createdDate','deleted','fileName','fullName','id','lineNumber','problem','problemType','success'};
    }
    public class FlowSubflowInputAssignment {
        public String name;
        public MetadataService.FlowElementReferenceOrValue value;
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] value_type_info = new String[]{'value','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'name','value'};
    }
    public class ReportType extends Metadata {
        public String type = 'ReportType';
        public String fullName;
        public Boolean autogenerated;
        public String baseObject;
        public String category;
        public Boolean deployed;
        public String description;
        public MetadataService.ObjectRelationship join_x;
        public String label;
        public MetadataService.ReportLayoutSection[] sections;
        private String[] autogenerated_type_info = new String[]{'autogenerated','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] baseObject_type_info = new String[]{'baseObject','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] category_type_info = new String[]{'category','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] deployed_type_info = new String[]{'deployed','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] join_x_type_info = new String[]{'join','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] label_type_info = new String[]{'label','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] sections_type_info = new String[]{'sections','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'autogenerated','baseObject','category','deployed','description','join_x','label','sections'};
    }
    public class CustomPageWebLink extends Metadata {
        public String type = 'CustomPageWebLink';
        public String fullName;
        public String availability;
        public String description;
        public String displayType;
        public String encodingKey;
        public Boolean hasMenubar;
        public Boolean hasScrollbars;
        public Boolean hasToolbar;
        public Integer height;
        public Boolean isResizable;
        public String linkType;
        public String masterLabel;
        public String openType;
        public String page_x;
        public String position;
        public Boolean protected_x;
        public Boolean requireRowSelection;
        public String scontrol;
        public Boolean showsLocation;
        public Boolean showsStatus;
        public String url;
        public Integer width;
        private String[] availability_type_info = new String[]{'availability','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] displayType_type_info = new String[]{'displayType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] encodingKey_type_info = new String[]{'encodingKey','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] hasMenubar_type_info = new String[]{'hasMenubar','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] hasScrollbars_type_info = new String[]{'hasScrollbars','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] hasToolbar_type_info = new String[]{'hasToolbar','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] height_type_info = new String[]{'height','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] isResizable_type_info = new String[]{'isResizable','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] linkType_type_info = new String[]{'linkType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] masterLabel_type_info = new String[]{'masterLabel','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] openType_type_info = new String[]{'openType','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] page_x_type_info = new String[]{'page','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] position_type_info = new String[]{'position','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] protected_x_type_info = new String[]{'protected','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] requireRowSelection_type_info = new String[]{'requireRowSelection','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] scontrol_type_info = new String[]{'scontrol','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showsLocation_type_info = new String[]{'showsLocation','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] showsStatus_type_info = new String[]{'showsStatus','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] url_type_info = new String[]{'url','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] width_type_info = new String[]{'width','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'availability','description','displayType','encodingKey','hasMenubar','hasScrollbars','hasToolbar','height','isResizable','linkType','masterLabel','openType','page_x','position','protected_x','requireRowSelection','scontrol','showsLocation','showsStatus','url','width'};
    }
    public class CodeCoverageResult {
        public MetadataService.CodeLocation[] dmlInfo;
        public String id;
        public MetadataService.CodeLocation[] locationsNotCovered;
        public MetadataService.CodeLocation[] methodInfo;
        public String name;
        public String namespace;
        public Integer numLocations;
        public Integer numLocationsNotCovered;
        public MetadataService.CodeLocation[] soqlInfo;
        public MetadataService.CodeLocation[] soslInfo;
        public String type_x;
        private String[] dmlInfo_type_info = new String[]{'dmlInfo','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] id_type_info = new String[]{'id','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] locationsNotCovered_type_info = new String[]{'locationsNotCovered','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] methodInfo_type_info = new String[]{'methodInfo','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] namespace_type_info = new String[]{'namespace','http://soap.sforce.com/2006/04/metadata',null,'1','1','true'};
        private String[] numLocations_type_info = new String[]{'numLocations','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] numLocationsNotCovered_type_info = new String[]{'numLocationsNotCovered','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] soqlInfo_type_info = new String[]{'soqlInfo','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] soslInfo_type_info = new String[]{'soslInfo','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] type_x_type_info = new String[]{'type','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'dmlInfo','id','locationsNotCovered','methodInfo','name','namespace','numLocations','numLocationsNotCovered','soqlInfo','soslInfo','type_x'};
    }
    public class renameMetadata_element {
        public String type_x;
        public String oldFullName;
        public String newFullName;
        private String[] type_x_type_info = new String[]{'type','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] oldFullName_type_info = new String[]{'oldFullName','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] newFullName_type_info = new String[]{'newFullName','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'type_x','oldFullName','newFullName'};
    }
    public class NetworkAccess {
        public MetadataService.IpRange[] ipRanges;
        private String[] ipRanges_type_info = new String[]{'ipRanges','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'ipRanges'};
    }
    public class RecordTypePicklistValue {
        public String picklist;
        public MetadataService.PicklistValue[] values;
        private String[] picklist_type_info = new String[]{'picklist','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] values_type_info = new String[]{'values','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'picklist','values'};
    }
    public class describeMetadata_element {
        public Double asOfVersion;
        private String[] asOfVersion_type_info = new String[]{'asOfVersion','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'asOfVersion'};
    }
    public class DashboardFilterColumn {
        public String column;
        private String[] column_type_info = new String[]{'column','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'column'};
    }
    public class Territory2RuleAssociation {
        public Boolean inherited;
        public String ruleName;
        private String[] inherited_type_info = new String[]{'inherited','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] ruleName_type_info = new String[]{'ruleName','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'inherited','ruleName'};
    }
    public class ReportParam {
        public String name;
        public String value;
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] value_type_info = new String[]{'value','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'name','value'};
    }
    public class RoleOrTerritory extends Metadata {
        public String type = 'RoleOrTerritory';
        public String fullName;
        public String caseAccessLevel;
        public String contactAccessLevel;
        public String description;
        public Boolean mayForecastManagerShare;
        public String name;
        public String opportunityAccessLevel;
        private String[] caseAccessLevel_type_info = new String[]{'caseAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] contactAccessLevel_type_info = new String[]{'contactAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] mayForecastManagerShare_type_info = new String[]{'mayForecastManagerShare','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] opportunityAccessLevel_type_info = new String[]{'opportunityAccessLevel','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'caseAccessLevel','contactAccessLevel','description','mayForecastManagerShare','name','opportunityAccessLevel'};
    }
    public class ForecastingTypeSettings {
        public Boolean active;
        public MetadataService.AdjustmentsSettings adjustmentsSettings;
        public MetadataService.ForecastRangeSettings forecastRangeSettings;
        public String name;
        public MetadataService.OpportunityListFieldsSelectedSettings opportunityListFieldsSelectedSettings;
        public MetadataService.QuotasSettings quotasSettings;
        private String[] active_type_info = new String[]{'active','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] adjustmentsSettings_type_info = new String[]{'adjustmentsSettings','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] forecastRangeSettings_type_info = new String[]{'forecastRangeSettings','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] opportunityListFieldsSelectedSettings_type_info = new String[]{'opportunityListFieldsSelectedSettings','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] quotasSettings_type_info = new String[]{'quotasSettings','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'active','adjustmentsSettings','forecastRangeSettings','name','opportunityListFieldsSelectedSettings','quotasSettings'};
    }
    public class FlowApexPluginCallInputParameter {
        public String name;
        public MetadataService.FlowElementReferenceOrValue value;
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] value_type_info = new String[]{'value','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'name','value'};
    }
    public class WorkflowActionReference {
        public String name;
        public String type_x;
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] type_x_type_info = new String[]{'type','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'name','type_x'};
    }
    public class Role {
        public String parentRole;
        private String[] parentRole_type_info = new String[]{'parentRole','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'parentRole'};
    }
    public class RetrieveResult {
        public Boolean done;
        public String errorMessage;
        public String errorStatusCode;
        public MetadataService.FileProperties[] fileProperties;
        public String id;
        public MetadataService.RetrieveMessage[] messages;
        public String status;
        public Boolean success;
        public String zipFile;
        private String[] done_type_info = new String[]{'done','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] errorMessage_type_info = new String[]{'errorMessage','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] errorStatusCode_type_info = new String[]{'errorStatusCode','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] fileProperties_type_info = new String[]{'fileProperties','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] id_type_info = new String[]{'id','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] messages_type_info = new String[]{'messages','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] status_type_info = new String[]{'status','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] success_type_info = new String[]{'success','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] zipFile_type_info = new String[]{'zipFile','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'done','errorMessage','errorStatusCode','fileProperties','id','messages','status','success','zipFile'};
    }
    public class CustomObjectSharingRules {
        public MetadataService.CustomObjectCriteriaBasedSharingRule[] criteriaBasedRules;
        public MetadataService.CustomObjectOwnerSharingRule[] ownerRules;
        private String[] criteriaBasedRules_type_info = new String[]{'criteriaBasedRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] ownerRules_type_info = new String[]{'ownerRules','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'criteriaBasedRules','ownerRules'};
    }
    public class QuickActionList {
        public MetadataService.QuickActionListItem[] quickActionListItems;
        private String[] quickActionListItems_type_info = new String[]{'quickActionListItems','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'quickActionListItems'};
    }
    public class RelatedList {
        public Boolean hideOnDetail;
        public String name;
        private String[] hideOnDetail_type_info = new String[]{'hideOnDetail','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'hideOnDetail','name'};
    }
    public class FlowActionCallOutputParameter {
        public String assignToReference;
        public String name;
        private String[] assignToReference_type_info = new String[]{'assignToReference','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'assignToReference','name'};
    }
    public class DashboardFilterOption {
        public String operator;
        public String[] values;
        private String[] operator_type_info = new String[]{'operator','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] values_type_info = new String[]{'values','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'operator','values'};
    }
    public class WorkflowOutboundMessage extends WorkflowAction {
        public String type = 'WorkflowOutboundMessage';
        public String fullName;
        public Double apiVersion;
        public String description;
        public String endpointUrl;
        public String[] fields;
        public Boolean includeSessionId;
        public String integrationUser;
        public String name;
        public Boolean protected_x;
        public Boolean useDeadLetterQueue;
        private String[] apiVersion_type_info = new String[]{'apiVersion','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] description_type_info = new String[]{'description','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] endpointUrl_type_info = new String[]{'endpointUrl','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] fields_type_info = new String[]{'fields','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] includeSessionId_type_info = new String[]{'includeSessionId','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] integrationUser_type_info = new String[]{'integrationUser','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] protected_x_type_info = new String[]{'protected','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] useDeadLetterQueue_type_info = new String[]{'useDeadLetterQueue','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] type_att_info = new String[]{'xsi:type'};
        private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] field_order_type_info = new String[]{'fullName', 'apiVersion','description','endpointUrl','fields','includeSessionId','integrationUser','name','protected_x','useDeadLetterQueue'};
    }
    public class RunTestSuccess {
        public String id;
        public String methodName;
        public String name;
        public String namespace;
        public Double time_x;
        private String[] id_type_info = new String[]{'id','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] methodName_type_info = new String[]{'methodName','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] name_type_info = new String[]{'name','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] namespace_type_info = new String[]{'namespace','http://soap.sforce.com/2006/04/metadata',null,'1','1','true'};
        private String[] time_x_type_info = new String[]{'time','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'id','methodName','name','namespace','time_x'};
    }
    public class LiveChatButtonDeployments {
        public String[] deployment;
        private String[] deployment_type_info = new String[]{'deployment','http://soap.sforce.com/2006/04/metadata',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'deployment'};
    }
    public class PermissionSetApplicationVisibility {
        public String application;
        public Boolean visible;
        private String[] application_type_info = new String[]{'application','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] visible_type_info = new String[]{'visible','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
        private String[] field_order_type_info = new String[]{'application','visible'};
    }
    public class InstalledPackage extends Metadata {
        public String type = 'InstalledPackage';
        public String fullName;
        public String password;
        public String versionNumber;
        private String[] password_type_info = new String[]{'password','http://soap.sforce.com/2006/04/metadata',null,'0','1','false'};
        private String[] versionNumber_type_info = new String[]{'versionNumber','http://soap.sforce.com/2006/04/metadata',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','tru
Download .txt
gitextract_dcfiskbn/

├── CODEOWNERS
├── LICENSE.md
├── README.md
├── custom_md_loader/
│   ├── applications/
│   │   └── Custom_Metadata_Loader.app
│   ├── classes/
│   │   ├── AppConstants.cls
│   │   ├── AppConstants.cls-meta.xml
│   │   ├── CSVFileUtil.cls
│   │   ├── CSVFileUtil.cls-meta.xml
│   │   ├── CustomMetadataLoaderController.cls
│   │   ├── CustomMetadataLoaderController.cls-meta.xml
│   │   ├── CustomMetadataLoaderControllerTest.cls
│   │   ├── CustomMetadataLoaderControllerTest.cls-meta.xml
│   │   ├── CustomMetadataUploadController.cls
│   │   ├── CustomMetadataUploadController.cls-meta.xml
│   │   ├── CustomMetadataUploadControllerTest.cls
│   │   ├── CustomMetadataUploadControllerTest.cls-meta.xml
│   │   ├── JsonUtilities.cls
│   │   ├── JsonUtilities.cls-meta.xml
│   │   ├── MDWrapperWebServiceMock.cls
│   │   ├── MDWrapperWebServiceMock.cls-meta.xml
│   │   ├── MetadataApexApiLoader.cls
│   │   ├── MetadataApexApiLoader.cls-meta.xml
│   │   ├── MetadataLoader.cls
│   │   ├── MetadataLoader.cls-meta.xml
│   │   ├── MetadataLoaderClient.cls
│   │   ├── MetadataLoaderClient.cls-meta.xml
│   │   ├── MetadataLoaderFactory.cls
│   │   ├── MetadataLoaderFactory.cls-meta.xml
│   │   ├── MetadataMapper.cls
│   │   ├── MetadataMapper.cls-meta.xml
│   │   ├── MetadataMapperCustom.cls
│   │   ├── MetadataMapperCustom.cls-meta.xml
│   │   ├── MetadataMapperDefault.cls
│   │   ├── MetadataMapperDefault.cls-meta.xml
│   │   ├── MetadataMapperFactory.cls
│   │   ├── MetadataMapperFactory.cls-meta.xml
│   │   ├── MetadataMapperSimple.cls
│   │   ├── MetadataMapperSimple.cls-meta.xml
│   │   ├── MetadataMapperType.cls
│   │   ├── MetadataMapperType.cls-meta.xml
│   │   ├── MetadataMappingInfo.cls
│   │   ├── MetadataMappingInfo.cls-meta.xml
│   │   ├── MetadataMigrationController.cls
│   │   ├── MetadataMigrationController.cls-meta.xml
│   │   ├── MetadataMigrationException.cls
│   │   ├── MetadataMigrationException.cls-meta.xml
│   │   ├── MetadataObjectCreator.cls
│   │   ├── MetadataObjectCreator.cls-meta.xml
│   │   ├── MetadataOpType.cls
│   │   ├── MetadataOpType.cls-meta.xml
│   │   ├── MetadataResponse.cls
│   │   ├── MetadataResponse.cls-meta.xml
│   │   ├── MetadataService.cls
│   │   ├── MetadataService.cls-meta.xml
│   │   ├── MetadataServiceTest.cls
│   │   ├── MetadataServiceTest.cls-meta.xml
│   │   ├── MetadataUtil.cls
│   │   ├── MetadataUtil.cls-meta.xml
│   │   ├── MetadataWrapperApiLoader.cls
│   │   └── MetadataWrapperApiLoader.cls-meta.xml
│   ├── labels/
│   │   └── CustomLabels.labels
│   ├── objects/
│   │   └── CountryMapping__mdt.object
│   ├── package.xml
│   ├── pages/
│   │   ├── CMTMigrator.page
│   │   ├── CMTMigrator.page-meta.xml
│   │   ├── CustomMetadataLoader.page
│   │   ├── CustomMetadataLoader.page-meta.xml
│   │   ├── CustomMetadataRecordUploader.page
│   │   └── CustomMetadataRecordUploader.page-meta.xml
│   ├── permissionsets/
│   │   └── Custom_Metadata_Loader.permissionset
│   └── tabs/
│       ├── CMT_Migrator.tab
│       └── Custom_Metadata_Loader.tab
└── sample.csv
Condensed preview — 73 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (989K chars).
[
  {
    "path": "CODEOWNERS",
    "chars": 140,
    "preview": "# Comment line immediately above ownership line is reserved for related gus information. Please be careful while editing"
  },
  {
    "path": "LICENSE.md",
    "chars": 3039,
    "preview": "Copyright (c) 2016, Salesforce.com, Inc. All rights reserved.\n\nRedistribution and use in source and binary forms, with o"
  },
  {
    "path": "README.md",
    "chars": 6693,
    "preview": "# Using CLI Commands\n\nSalesforce CLI commands for custom metadata types are available in v49. The custom metadata loader"
  },
  {
    "path": "custom_md_loader/applications/Custom_Metadata_Loader.app",
    "chars": 371,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<CustomApplication xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n    <defaultL"
  },
  {
    "path": "custom_md_loader/classes/AppConstants.cls",
    "chars": 1128,
    "preview": "/**\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/AppConstants.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/CSVFileUtil.cls",
    "chars": 3270,
    "preview": "/* \n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/CSVFileUtil.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/CustomMetadataLoaderController.cls",
    "chars": 2100,
    "preview": "/* \n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/CustomMetadataLoaderController.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/CustomMetadataLoaderControllerTest.cls",
    "chars": 1728,
    "preview": "/* \n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/CustomMetadataLoaderControllerTest.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/CustomMetadataUploadController.cls",
    "chars": 8799,
    "preview": "/* \n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/CustomMetadataUploadController.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/CustomMetadataUploadControllerTest.cls",
    "chars": 3728,
    "preview": "/* \n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/CustomMetadataUploadControllerTest.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/JsonUtilities.cls",
    "chars": 1859,
    "preview": "/* \r\n * Copyright (c) 2016, salesforce.com, inc.\r\n * All rights reserved.\r\n * Licensed under the BSD 3-Clause license. \r"
  },
  {
    "path": "custom_md_loader/classes/JsonUtilities.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MDWrapperWebServiceMock.cls",
    "chars": 1604,
    "preview": "/* \n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/MDWrapperWebServiceMock.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataApexApiLoader.cls",
    "chars": 7126,
    "preview": "/*\r\n * Copyright (c) 2016, salesforce.com, inc.\r\n * All rights reserved.\r\n * Licensed under the BSD 3-Clause license.\r\n "
  },
  {
    "path": "custom_md_loader/classes/MetadataApexApiLoader.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataLoader.cls",
    "chars": 5607,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataLoader.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataLoaderClient.cls",
    "chars": 3295,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataLoaderClient.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataLoaderFactory.cls",
    "chars": 603,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataLoaderFactory.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapper.cls",
    "chars": 1221,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapper.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperCustom.cls",
    "chars": 3349,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperCustom.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperDefault.cls",
    "chars": 3625,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperDefault.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperFactory.cls",
    "chars": 701,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperFactory.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperSimple.cls",
    "chars": 3133,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperSimple.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperType.cls",
    "chars": 289,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataMapperType.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMappingInfo.cls",
    "chars": 2180,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataMappingInfo.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMigrationController.cls",
    "chars": 7583,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataMigrationController.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataMigrationException.cls",
    "chars": 294,
    "preview": "/**\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * F"
  },
  {
    "path": "custom_md_loader/classes/MetadataMigrationException.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>40.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataObjectCreator.cls",
    "chars": 6928,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataObjectCreator.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataOpType.cls",
    "chars": 293,
    "preview": "/* \n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/MetadataOpType.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataResponse.cls",
    "chars": 1539,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataResponse.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>39.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataService.cls",
    "chars": 788794,
    "preview": "/**\n * Copyright (c), FinancialForce.com, inc\n * All rights reserved.\n *\n * Redistribution and use in source and binary "
  },
  {
    "path": "custom_md_loader/classes/MetadataService.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataServiceTest.cls",
    "chars": 47255,
    "preview": "/**\n * Copyright (c) 2012, FinancialForce.com, inc\n * All rights reserved.\n *\n * Redistribution and use in source and bi"
  },
  {
    "path": "custom_md_loader/classes/MetadataServiceTest.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataUtil.cls",
    "chars": 9197,
    "preview": "/* \n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n * "
  },
  {
    "path": "custom_md_loader/classes/MetadataUtil.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/classes/MetadataWrapperApiLoader.cls",
    "chars": 8758,
    "preview": "/*\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * Fo"
  },
  {
    "path": "custom_md_loader/classes/MetadataWrapperApiLoader.cls-meta.xml",
    "chars": 168,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexClass xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>34.0</ap"
  },
  {
    "path": "custom_md_loader/labels/CustomLabels.labels",
    "chars": 7850,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<CustomLabels xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n   <labels>\n      "
  },
  {
    "path": "custom_md_loader/objects/CountryMapping__mdt.object",
    "chars": 993,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--Copyright (c) 2016, salesforce.com, inc. All rights reserved. Licensed under "
  },
  {
    "path": "custom_md_loader/package.xml",
    "chars": 2157,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Package xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<types>\n\t\t<members>App"
  },
  {
    "path": "custom_md_loader/pages/CMTMigrator.page",
    "chars": 6003,
    "preview": "<!--\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license.\n * "
  },
  {
    "path": "custom_md_loader/pages/CMTMigrator.page-meta.xml",
    "chars": 275,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ApexPage xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n\t<apiVersion>40.0</api"
  },
  {
    "path": "custom_md_loader/pages/CustomMetadataLoader.page",
    "chars": 3942,
    "preview": "<!--\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n *"
  },
  {
    "path": "custom_md_loader/pages/CustomMetadataLoader.page-meta.xml",
    "chars": 513,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--Copyright (c) 2016, salesforce.com, inc. All rights reserved. Licensed \n\tunde"
  },
  {
    "path": "custom_md_loader/pages/CustomMetadataRecordUploader.page",
    "chars": 2217,
    "preview": "<!--\n * Copyright (c) 2016, salesforce.com, inc.\n * All rights reserved.\n * Licensed under the BSD 3-Clause license. \n *"
  },
  {
    "path": "custom_md_loader/pages/CustomMetadataRecordUploader.page-meta.xml",
    "chars": 521,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--Copyright (c) 2016, salesforce.com, inc. All rights reserved. Licensed \n\tunde"
  },
  {
    "path": "custom_md_loader/permissionsets/Custom_Metadata_Loader.permissionset",
    "chars": 2322,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<PermissionSet xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n    <applicationV"
  },
  {
    "path": "custom_md_loader/tabs/CMT_Migrator.tab",
    "chars": 257,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<CustomTab xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n    <label>Custom Met"
  },
  {
    "path": "custom_md_loader/tabs/Custom_Metadata_Loader.tab",
    "chars": 264,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<CustomTab xmlns=\"http://soap.sforce.com/2006/04/metadata\">\n    <label>Custom Met"
  },
  {
    "path": "sample.csv",
    "chars": 410,
    "preview": "Label,ns1__CountryCode__c,ns1__CountryName__c\nAustralia,AU,Australia\nBrazil,BZ,Brazil\nCanada,CA,Canada\nChina,CH,China\nDe"
  }
]

About this extraction

This page contains the full source code of the forcedotcom/CustomMetadataLoader GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 73 files (946.0 KB), approximately 226.6k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!