SFDC/Constants.pm

filter: Statementstmt 100% 30 / 30 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 14 / 14 Podpod 100% 6 / 6 totaltotal 92.7% 51 / 55 CC 2 SCAR 1.5
CC
2
Cov
94%
getName
2.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« SFDC.pm ↑ Summary SFDC/Manifest.pm »
1 package WWW::SFDC::Constants;
2 # ABSTRACT: Data about SFDC Metadata Components.
3  
4 1 ▶use 5.12.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Log::Log4perl ':easy';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 BEGIN {
12 1 ▶ use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶ our @ISA = qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 our @EXPORT_OK = qw(needsMetaFile hasFolders getEnding getDiskName getName getSubcomponents);
15 }
16  
17  
18 1 my %TYPES = (
19 applications => {
20 name => "CustomApplication",
21 ending => ".app",
22 },
23 approvalProcesses => {
24 name => "ApprovalProcess",
25 ending => ".approvalProcess"
26 },
27 classes => {
28 name => "ApexClass",
29 ending => ".cls",
30 meta => 1,
31 },
32 components => {
33 name => "ApexComponent",
34 ending => ".component",
35 meta => 1,
36 },
37 datacategorygroups => {
38 name => "DataCategoryGroup",
39 ending => "UNKNOWN"
40 },
41 documents => {
42 name => "Document",
43 ending => undef,
44 meta => 1,
45 folders => 1,
46 },
47 email => {
48 name => "EmailTemplate",
49 ending => ".email",
50 meta => 1,
51 folders => 1,
52 },
53 flows => {
54 name => "Flow",
55 ending => "UNKNOWN"
56 },
57 groups => {
58 name => "Group",
59 ending => ".group"
60 },
61 homePageComponents => {
62 name => "HomePageComponent",
63 ending => ".homePageComponent"
64 },
65 homePageLayouts => {
66 name => "HomePageLayout",
67 ending => ".homePageLayout"
68 },
69 labels => {
70 name => "CustomLabels",
71 ending => ".labels"
72 },
73 layouts => {
74 name => "Layout",
75 ending => ".layout"
76 },
77 objects => {
78 name => "CustomObject",
79 ending => ".object"
80 },
81 pages => {
82 name => "ApexPage",
83 ending => ".page",
84 meta => 1,
85 },
86 permissionsets => {
87 name => "PermissionSet",
88 ending => ".permissionset"
89 },
90 portals => {
91 name => "Portal",
92 ending => ".portal"
93 },
94 profiles => {
95 name => "Profile",
96 ending => ".profile"
97 },
98 queues => {
99 name => "Queue",
100 ending => ".queue"
101 },
102 quickActions => {
103 name => "QuickAction",
104 ending => ".quickAction"
105 },
106 remoteSiteSettings => {
107 name => "RemoteSiteSetting",
108 ending => ".remoteSite"
109 },
110 reportTypes => {
111 name => "ReportType",
112 ending => ".reportType"
113 },
114 reports => {
115 name => "Report",
116 ending => ".report",
117 folders => 1,
118 },
119 roles => {
120 name => "Role",
121 ending => "role"
122 },
123 sites => {
124 name => "CustomSite",
125 ending => ".site"
126 },
127 settings => {
128 name => "Settings",
129 ending => ".settings",
130 },
131 sharingRules => {
132 name => "SharingRules",
133 ending => ".sharingRules"
134 },
135 staticresources => {
136 name => "StaticResource",
137 ending => ".resource",
138 meta => 1,
139 },
140 tabs => {
141 name => "CustomTab",
142 ending => ".tab"
143 },
144 translations => {
145 name => "Translations",
146 ending => ".translation",
147 },
148 triggers => {
149 name => "ApexTrigger",
150 ending => ".trigger",
151 meta => 1,
152 },
153 weblinks => {
154 name => "CustomPageWebLink",
155 ending => ".weblink"
156 },
157 workflows => {
158 name => "Workflow",
159 ending => ".workflow"
160 },
161 #subcomponents
162 actionOverrides => {
163 name => "ActionOverride",
164 subcomponent => 1
165 },
166 alerts => {
167 name => "WorkflowAlert",
168 subcomponent => 1
169 },
170 businessProcesses => {
171 name => "BusinessProcess",
172 subcomponent => 1
173 },
174 fieldSets => {
175 name => "FieldSet",
176 subcomponent => 1
177 },
178 fieldUpdates => {
179 name => "WorkflowFieldUpdate",
180 subcomponent => 1
181 },
182 fields => {
183 name => "CustomField",
184 subcomponent => 1
185 },
186 listViews => {
187 name => "ListView",
188 subcomponent => 1
189 },
190 outboundMessages => {
191 name => "WorkflowOutboundMessage",
192 subcomponent => 1
193 },
194 recordTypes => {
195 name => "RecordType",
196 subcomponent => 1
197 },
198 rules => {
199 name => "WorkflowRule",
200 subcomponent => 1
201 },
202 tasks => {
203 name => "WorkflowTask",
204 subcomponent => 1
205 },
206 validationRules => {
207 name => "ValidationRule",
208 subcomponent => 1
209 },
210 webLinks => {
211 name => "WebLink",
212 subcomponent => 1
213 },
214 );
215  
216  
217 sub needsMetaFile {
218 1 ▶ return $TYPES{+shift}->{meta};
Subroutine needsMetaFile: called CC=1 SCAR=0.0
Pod documented
219 }
220  
221  
222 sub hasFolders {
223 1 ▶ return $TYPES{+shift}->{folders};
Subroutine hasFolders: called CC=1 SCAR=0.0
Pod documented
224 }
225  
226  
227 sub getEnding {
228 1 ▶ return $TYPES{+shift}->{ending};
Subroutine getEnding: called CC=1 SCAR=0.0
Pod documented
229 }
230  
231  
232 sub getDiskName {
233 1 ▶ my $query = shift;
Subroutine getDiskName: called CC=1 SCAR=0.0
Pod documented
234 1 ▶ return first {$TYPES{$_}->{name} eq $query} keys %TYPES;
Subroutine __ANON__: called CC=1 SCAR=0.0
235 }
236  
237  
238 sub getName {
239 1 ▶ my $type = shift;
Subroutine getName: called CC=2 SCAR=8.1
Pod documented
240 1 ▶ return $TYPES{$type}->{name} || LOGDIE "Type $type doesn't have a name!";
Condition33%1/3
$TYPES{$type}{'name'} || LOGDIE("Type $type doesn't have a name!")
l!l&&r!l&&!r
100
MC/DC0%0/2
$TYPES{$type}{'name'} || LOGDIE("Type $type doesn't have a name!")
$TYPES{$type}{'name'} LOGDIE("Type $type doesn't have a name!")
Truth table33%1/3
A || B
A= $TYPES{$type}{'name'}B= LOGDIE("Type $type doesn't have a name!")
ABresult
1X1
011
000
241 }
242  
243  
244 sub getSubcomponents {
245 1 ▶ return grep {$TYPES{$_}->{subcomponent}} keys %TYPES;
Subroutine getSubcomponents: called CC=1 SCAR=0.0
Pod documented
246 }
247  
248 __END__
249  
250 =pod
251  
252 =head1 NAME
253  
254 WWW::SFDC::Constants - Data about SFDC Metadata Components.
255  
256 =head1 VERSION
257  
258 version 0.22
259  
260 =head1 METHODS
261  
262 =head2 needsMetaFile
263  
264 =head2 hasFolders
265  
266 =head2 getEnding
267  
268 =head2 getDiskName
269  
270 =head2 getName
271  
272 =head2 getSubcomponents
273  
274 =head1 Metadata Types
275  
276 =head2 ending
277  
278 Stores the file ending for the metadata type, if there is one.
279  
280 NB that two of these values are UNKNOWN because I don't know what the value is.
281  
282 =head2 name
283  
284 Stores the metadata API name corresponding to the folder name on disk. For instance, the
285 metadata name corresponding to the applications/ folder is CustomApplication, but the name
286 corresponding to flows/ is Flow.
287  
288 =head2 meta
289  
290 Set if the component has associated -meta.xml files (nb not counting folder xml files).
291  
292 =head2 folders
293  
294 Set if the type occurs within folders.
295  
296 =head1 AUTHOR
297  
298 Alexander Brett <alexander.brett@sophos.com>
299  
300 =head1 COPYRIGHT AND LICENSE
301  
302 This software is Copyright (c) 2015 by Sophos Limited.
303  
304 This is free software, licensed under:
305  
306 The MIT (X11) License
307  
308 The full text of the license can be found in the
309 F<LICENSE> file included with this distribution.
310  
311 =cut
« SFDC.pm ↑ Summary SFDC/Manifest.pm »