Skip to content

Commit

Permalink
Merge pull request #39 from alan-morey/metadata_v35
Browse files Browse the repository at this point in the history
Add support for Salesforce Metadata API v35
  • Loading branch information
alan-morey committed Oct 21, 2015
2 parents fa681da + cf3abd5 commit 2a36079
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ant-includes/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ sf.maxPoll = 200
sf.batchSize = 20

# The version of the antlib jar in lib
sf.antlib.version = 33.0
sf.antlib.version = 35.0
52 changes: 39 additions & 13 deletions force-meta-backup.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -241,27 +241,32 @@ class BulkMetadataManifestBuilder {
'ConnectedApp',
'CorsWhitelistOrigin',
'CustomApplicationComponent',
'CustomFeedFilter',
'CustomLabels',
'CustomMetadata',
'CustomPageWebLink',
'CustomSite',
'DataCategoryGroup',
'EntitlementProcess',
'EntitlementTemplate',
'EscalationRules',
'FlexiPage',
'Flow',
'FlowDefinition',
'Group',
'HomePageComponent',
'HomePageLayout',
'InstalledPackage',
'LiveChatAgentConfig',
'LiveChatButton',
'LiveChatDeployment',
'LiveChatSensitiveDataRule',
'ManagedTopics',
'MatchingRule',
'MilestoneType',
'NamedCredential',
'Network',
'PathAssistant',
'PlatformCachePartition',
'Portal',
'PostTemplate',
'Queue',
Expand All @@ -286,6 +291,7 @@ class BulkMetadataManifestBuilder {
'Territory2Rule',
'Territory2Settings',
'Territory2Type',
'TransactionSecurityPolicy',
'Workflow',
'XOrgHub',
'XOrgHubSharedObject'
Expand Down Expand Up @@ -365,16 +371,14 @@ class Folders {
types {

folders.each { folderName ->
members {
mkp.yield folderName
}
members folderName
}

name() { mkp.yield folderMetaTypeByFolderType[folderType] }
name folderMetaTypeByFolderType[folderType]
}
}

version { mkp.yield forceService.apiVersion }
version forceService.apiVersion
}
}

Expand Down Expand Up @@ -485,7 +489,15 @@ class MiscMetadataManifestBuilder {
static final PACKAGE_XML = 'misc-package.xml'

static final TYPES = [
'Letterhead',
'Letterhead'
]

static final WILDCARD_TYPES = [
// XXX Salesforce can't retrieve Flow by bulkRetrieve, the active
// version number need to be applied to the fullName. I think only way
// to find that is in FlowDefinition and that would require parsing
// Using * wildcard simplifiies the retrieval for Flows.
'Flow'
]

MiscMetadataManifestBuilder(ForceService forceService, config) {
Expand Down Expand Up @@ -531,14 +543,21 @@ class MiscMetadataManifestBuilder {
groupedFileProperties.each { type, fileProperties ->
types {
fileProperties.each { fp ->
members { mkp.yield fp.fullName }
members fp.fullName
}

name() { mkp.yield type}
name type
}
}

version { mkp.yield forceService.apiVersion }
WILDCARD_TYPES.each { type ->
types {
members '*'
name type
}
}

version forceService.apiVersion
}
}

Expand Down Expand Up @@ -573,6 +592,7 @@ class ProfilesMetadataManifestBuilder {
this.forceService = forceService
this.config = config
}

private getGroupedFileProperties() {
if (groupedFileProps == null) {

Expand Down Expand Up @@ -613,18 +633,24 @@ class ProfilesMetadataManifestBuilder {
def builder = new StreamingMarkupBuilder()
builder.encoding = 'UTF-8'

def WILDCARD_TYPES = [] + PERMISSON_TYPES;
if (type == 'Layout') {
// Note: Page Layout assignments require Layouts & RecordType to be retrieved with Profile
WILDCARD_TYPES << 'RecordType'
}

def xml = builder.bind {
mkp.xmlDeclaration()
Package(xmlns: 'http://soap.sforce.com/2006/04/metadata') {
types {
fileProperties.each { fp ->
members { mkp.yield fp.fullName }
members fp.fullName
}

name() { mkp.yield type}
name type
}

PERMISSON_TYPES.each { metadataType ->
WILDCARD_TYPES.each { metadataType ->
types {
members '*'
name metadataType
Expand Down
Binary file not shown.

0 comments on commit 2a36079

Please sign in to comment.