]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - service/v2/registry.php
Release 6.5.0
[Github/sugarcrm.git] / service / v2 / registry.php
1 <?php
2 if(!defined('sugarEntry'))define('sugarEntry', true);
3 /*********************************************************************************
4  * SugarCRM Community Edition is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38
39 /**
40  * This class is responsible for providing all the registration of all the functions and complex types
41  *
42  */
43 class registry {
44         
45         protected $serviceClass = null;
46         
47         /**
48          * Constructor.
49          *
50          * @param Class - $serviceClass
51          */
52         public function __construct($serviceClass) {
53                 $this->serviceClass = $serviceClass;
54         } // fn
55                         
56         /**
57          * It registers all the functions and types by doign a call back method on service object
58          *
59          */
60         public function register() {
61                 $this->registerFunction();
62                 $this->registerTypes();
63         }
64         
65         /**
66          * This mehtod registers all the functions on the service class
67          *
68          */
69         protected function registerFunction() {
70                 // START OF REGISTER FUNCTIONS
71                 
72                 $GLOBALS['log']->info('Begin: registry->registerFunction');
73                 
74                 $this->serviceClass->registerFunction(
75                         'login',
76                      array('user_auth'=>'tns:user_auth', 'application_name'=>'xsd:string', 'name_value_list'=>'tns:name_value_list'),
77                      array('return'=>'tns:entry_value')
78                      );
79                      
80                 $this->serviceClass->registerFunction(
81                         'logout',
82                          array('session'=>'xsd:string'),
83                          array());
84                          
85                 $this->serviceClass->registerFunction(
86                     'get_entry',
87                     array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'id'=>'xsd:string', 'select_fields'=>'tns:select_fields','link_name_to_fields_array'=>'tns:link_names_to_fields_array'),
88                     array('return'=>'tns:get_entry_result_version2'));
89                     
90                 $this->serviceClass->registerFunction(
91                     'get_entries',
92                     array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'ids'=>'tns:select_fields', 'select_fields'=>'tns:select_fields', 'link_name_to_fields_array'=>'tns:link_names_to_fields_array'),
93                     array('return'=>'tns:get_entry_result_version2'));
94                     
95                 $this->serviceClass->registerFunction(
96                     'get_entry_list',
97                     array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'query'=>'xsd:string', 'order_by'=>'xsd:string','offset'=>'xsd:int', 'select_fields'=>'tns:select_fields', 'link_name_to_fields_array'=>'tns:link_names_to_fields_array', 'max_results'=>'xsd:int', 'deleted'=>'xsd:int'),
98                     array('return'=>'tns:get_entry_list_result_version2'));
99                     
100                 $this->serviceClass->registerFunction(
101                     'set_relationship',
102                     array('session'=>'xsd:string','module_name'=>'xsd:string','module_id'=>'xsd:string','link_field_name'=>'xsd:string', 'related_ids'=>'tns:select_fields', 'name_value_list'=>'tns:name_value_list', 'delete'=>'xsd:int'),
103                     array('return'=>'tns:new_set_relationship_list_result'));
104                     
105                 $this->serviceClass->registerFunction(
106                     'set_relationships',
107                     array('session'=>'xsd:string','module_names'=>'tns:select_fields','module_ids'=>'tns:select_fields','link_field_names'=>'tns:select_fields','related_ids'=>'tns:new_set_relationhip_ids', 'name_value_lists'=>'tns:name_value_lists', 'delete_array' => 'tns:deleted_array'),
108                     array('return'=>'tns:new_set_relationship_list_result'));
109                     
110                 $this->serviceClass->registerFunction(
111                     'get_relationships',
112                     array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'module_id'=>'xsd:string', 'link_field_name'=>'xsd:string', 'related_module_query'=>'xsd:string', 'related_fields'=>'tns:select_fields', 'related_module_link_name_to_fields_array'=>'tns:link_names_to_fields_array', 'deleted'=>'xsd:int'),
113                     array('return'=>'tns:get_entry_result_version2'));
114                     
115                 $this->serviceClass->registerFunction(
116                     'set_entry',
117                     array('session'=>'xsd:string', 'module_name'=>'xsd:string',  'name_value_list'=>'tns:name_value_list'),
118                     array('return'=>'tns:new_set_entry_result'));
119                     
120                 $this->serviceClass->registerFunction(
121                     'set_entries',
122                     array('session'=>'xsd:string', 'module_name'=>'xsd:string',  'name_value_lists'=>'tns:name_value_lists'),
123                     array('return'=>'tns:new_set_entries_result'));
124                                     
125                 $this->serviceClass->registerFunction(
126                     'get_server_info',
127                     array(),
128                     array('return'=>'tns:get_server_info_result'));
129
130                 $this->serviceClass->registerFunction(
131                     'get_user_id',
132                     array('session'=>'xsd:string'),
133                     array('return'=>'xsd:string'));
134                     
135                 $this->serviceClass->registerFunction(
136                     'get_module_fields',
137                     array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'fields'=>'tns:select_fields'),
138                     array('return'=>'tns:new_module_fields'));
139                     
140                 $this->serviceClass->registerFunction(
141                     'seamless_login',
142                     array('session'=>'xsd:string'),
143                     array('return'=>'xsd:int'));
144                     
145                 $this->serviceClass->registerFunction(
146                     'set_note_attachment',
147                 array('session'=>'xsd:string','note'=>'tns:new_note_attachment'),
148                 array('return'=>'tns:new_set_entry_result'));
149
150                 $this->serviceClass->registerFunction(
151                     'get_note_attachment',
152                     array('session'=>'xsd:string', 'id'=>'xsd:string'),
153                     array('return'=>'tns:new_return_note_attachment'));
154                 
155                 $this->serviceClass->registerFunction(
156                     'set_document_revision',
157                 array('session'=>'xsd:string','note'=>'tns:document_revision'),
158                 array('return'=>'tns:new_set_entry_result'));
159
160                 $this->serviceClass->registerFunction(
161                     'get_document_revision',
162                 array('session'=>'xsd:string','i'=>'xsd:string'),
163                 array('return'=>'tns:new_return_document_revision'));
164
165                 $this->serviceClass->registerFunction(
166                     'search_by_module',
167                 array('session'=>'xsd:string','search_string'=>'xsd:string', 'modules'=>'tns:select_fields', 'offset'=>'xsd:int', 'max_results'=>'xsd:int'),
168                 array('return'=>'tns:return_search_result'));
169
170                 $this->serviceClass->registerFunction(
171                     'get_available_modules',
172                 array('session'=>'xsd:string'),
173                 array('return'=>'tns:module_list'));
174
175                 $this->serviceClass->registerFunction(
176                     'get_user_team_id',
177                 array('session'=>'xsd:string'),
178                 array('return'=>'xsd:string'));
179                 $this->serviceClass->registerFunction(
180                     'set_campaign_merge',
181                 array('session'=>'xsd:string', 'targets'=>'tns:select_fields', 'campaign_id'=>'xsd:string'),
182                 array());
183                 $this->serviceClass->registerFunction(
184                     'get_entries_count',
185                 array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'query'=>'xsd:string', 'deleted' => 'xsd:int'),
186                 array('return'=>'tns:get_entries_count_result'));
187
188                 
189             $GLOBALS['log']->info('END: registry->registerFunction');
190                 
191                 // END OF REGISTER FUNCTIONS
192         } // fn 
193
194         /**
195          * This method registers all the complex types
196          *
197          */
198         protected function registerTypes() {
199                 
200                 // START OF REGISTER COMPLEX TYPES
201                 
202                 $GLOBALS['log']->info('Begin: registry->registerTypes');
203
204                 $this->serviceClass->registerType(
205                     'new_note_attachment',
206                     'complexType',
207                     'struct',
208                     'all',
209                     '',
210                     array(
211                         "id" => array('name'=>"id",'type'=>'xsd:string'),
212                                 "filename" => array('name'=>"filename",'type'=>'xsd:string'),
213                                 "file" => array('name'=>"file",'type'=>'xsd:string'),
214                                 "related_module_id" => array('name'=>"related_module_id",'type'=>'xsd:string'),
215                                 "related_module_name" => array('name'=>"related_module_name",'type'=>'xsd:string'),
216                     )
217                 );
218
219                 $this->serviceClass->registerType(
220                     'new_return_note_attachment',
221                     'complexType',
222                     'struct',
223                     'all',
224                     '',
225                     array(
226                         "note_attachment"=>array('name'=>'note_attachment', 'type'=>'tns:new_note_attachment'),
227                     )
228                 );
229
230                 $this->serviceClass->registerType(
231                          'user_auth',
232                          'complexType',
233                          'struct',
234                          'all',
235                           '',
236                         array(
237                                 'user_name'=>array('name'=>'user_name', 'type'=>'xsd:string'),
238                                 'password' => array('name'=>'password', 'type'=>'xsd:string'),
239                         )
240                 );
241                 
242                 $this->serviceClass->registerType(
243                     'field',
244                         'complexType',
245                          'struct',
246                          'all',
247                           '',
248                                 array(
249                                         'name'=>array('name'=>'name', 'type'=>'xsd:string'),
250                                         'type'=>array('name'=>'type', 'type'=>'xsd:string'),
251                                         'label'=>array('name'=>'label', 'type'=>'xsd:string'),
252                                         'required'=>array('name'=>'required', 'type'=>'xsd:int'),
253                                         'options'=>array('name'=>'options', 'type'=>'tns:name_value_list'),
254                             'default_value'=>array('name'=>'name', 'type'=>'xsd:string'),
255                                 )
256                 );
257
258                 $this->serviceClass->registerType(
259                     'field_list',
260                         'complexType',
261                          'array',
262                          '',
263                           'SOAP-ENC:Array',
264                         array(),
265                     array(
266                         array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:field[]')
267                     ),
268                         'tns:field'
269                 );
270
271                 $this->serviceClass->registerType(
272                     'link_field',
273                         'complexType',
274                          'struct',
275                          'all',
276                           '',
277                                 array(
278                                         'name'=>array('name'=>'name', 'type'=>'xsd:string'),
279                                         'type'=>array('name'=>'type', 'type'=>'xsd:string'),
280                                         'relationship'=>array('name'=>'relationship', 'type'=>'xsd:string'),
281                                         'module'=>array('name'=>'module', 'type'=>'xsd:string'),
282                                         'bean_name'=>array('name'=>'bean_name', 'type'=>'xsd:string'),
283                                 )
284                 );
285                 
286                 $this->serviceClass->registerType(
287                     'link_field_list',
288                         'complexType',
289                          'array',
290                          '',
291                           'SOAP-ENC:Array',
292                         array(),
293                     array(
294                         array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:link_field[]')
295                     ),
296                         'tns:link_field'
297                 );
298
299                 $this->serviceClass->registerType(
300                     'name_value',
301                         'complexType',
302                          'struct',
303                          'all',
304                           '',
305                                 array(
306                                 'name'=>array('name'=>'name', 'type'=>'xsd:string'),
307                                         'value'=>array('name'=>'value', 'type'=>'xsd:string'),
308                                 )
309                 );
310
311                 $this->serviceClass->registerType(
312                     'name_value_list',
313                         'complexType',
314                          'array',
315                          '',
316                           'SOAP-ENC:Array',
317                         array(),
318                     array(
319                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:name_value[]')
320                     ),
321                         'tns:name_value'
322                 );
323
324                 $this->serviceClass->registerType(
325                     'name_value_lists',
326                         'complexType',
327                          'array',
328                          '',
329                           'SOAP-ENC:Array',
330                         array(),
331                     array(
332                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:name_value_list[]')
333                     ),
334                         'tns:name_value_list'
335                 );
336
337                 $this->serviceClass->registerType(
338                     'select_fields',
339                         'complexType',
340                          'array',
341                          '',
342                           'SOAP-ENC:Array',
343                         array(),
344                     array(
345                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'xsd:string[]')
346                     ),
347                         'xsd:string'
348                 );
349
350                 $this->serviceClass->registerType(
351                     'deleted_array',
352                         'complexType',
353                          'array',
354                          '',
355                           'SOAP-ENC:Array',
356                         array(),
357                     array(
358                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'xsd:int[]')
359                     ),
360                         'xsd:string'
361                 );
362                 
363                 $this->serviceClass->registerType(
364                     'new_module_fields',
365                         'complexType',
366                          'struct',
367                          'all',
368                           '',
369                                 array(
370                                 'module_name'=>array('name'=>'module_name', 'type'=>'xsd:string'),
371                                         'module_fields'=>array('name'=>'module_fields', 'type'=>'tns:field_list'),
372                                         'link_fields'=>array('name'=>'link_fields', 'type'=>'tns:link_field_list'),
373                                 )
374                 );
375                 
376                 $this->serviceClass->registerType(
377                     'entry_value',
378                         'complexType',
379                          'struct',
380                          'all',
381                           '',
382                                 array(
383                                 'id'=>array('name'=>'id', 'type'=>'xsd:string'),
384                                         'module_name'=>array('name'=>'module_name', 'type'=>'xsd:string'),
385                                         'name_value_list'=>array('name'=>'name_value_list', 'type'=>'tns:name_value_list'),
386                                 )
387                 );
388                 
389                 $this->serviceClass->registerType(
390                     'entry_list',
391                         'complexType',
392                          'array',
393                          '',
394                           'SOAP-ENC:Array',
395                         array(),
396                     array(
397                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:entry_value[]')
398                     ),
399                         'tns:entry_value'
400                 );
401
402                 $this->serviceClass->registerType(
403                          'set_entries_detail_result',
404                          'complexType',
405                          'struct',
406                          'all',
407                           '',
408                         array(
409                                 'name_value_lists' => array('name'=>'name_value_lists', 'type'=>'tns:name_value_lists'),
410                         )
411                 );                      
412                 $this->serviceClass->registerType(
413                     'link_names_to_fields_array',
414                         'complexType',
415                          'array',
416                          '',
417                           'SOAP-ENC:Array',
418                         array(),
419                     array(
420                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_name_to_fields_array[]')
421                     ),
422                         'tns:link_name_to_fields_array'
423                 );
424                 
425                 $this->serviceClass->registerType(
426                     'link_name_to_fields_array',
427                         'complexType',
428                          'struct',
429                          'all',
430                           '',
431                                 array(
432                                         'name'=>array('name'=>'name', 'type'=>'xsd:string'),
433                                                 'value'=>array('name'=>'value', 'type'=>'tns:select_fields'),
434                                 )
435                 );
436                 
437                 $this->serviceClass->registerType(
438                     'link_value',
439                         'complexType',
440                          'array',
441                          '',
442                           'SOAP-ENC:Array',
443                         array(),
444                     array(
445                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:name_value[]')
446                     ),
447                         'tns:name_value'
448                 );
449                 
450                 $this->serviceClass->registerType(
451                     'link_array_list',
452                         'complexType',
453                          'array',
454                          '',
455                           'SOAP-ENC:Array',
456                         array(),
457                     array(
458                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_value[]')
459                     ),
460                         'tns:link_value'
461                 );
462
463                 $this->serviceClass->registerType(
464                     'link_name_value',
465                         'complexType',
466                          'struct',
467                          'all',
468                           '',
469                                 array(
470                                 'name'=>array('name'=>'name', 'type'=>'xsd:string'),
471                                         'records'=>array('name'=>'records', 'type'=>'tns:link_array_list'),
472                                 )
473                 );
474
475                 $this->serviceClass->registerType(
476                     'link_list',
477                         'complexType',
478                          'array',
479                          '',
480                           'SOAP-ENC:Array',
481                         array(),
482                     array(
483                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_name_value[]')
484                     ),
485                         'tns:link_name_value'
486                 );
487                 
488                 $this->serviceClass->registerType(
489                     'link_lists',
490                         'complexType',
491                          'array',
492                          '',
493                           'SOAP-ENC:Array',
494                         array(),
495                     array(
496                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_list[]')
497                     ),
498                         'tns:link_list'
499                 );
500                 
501                 $this->serviceClass->registerType(
502                          'get_entry_result_version2',
503                          'complexType',
504                          'struct',
505                          'all',
506                           '',
507                         array(
508                                 'entry_list' => array('name' =>'entry_list', 'type'=>'tns:entry_list'),
509                                 'relationship_list' => array('name' =>'relationship_list', 'type'=>'tns:link_lists'),
510                         )
511                 );
512                 
513                 $this->serviceClass->registerType(
514                          'return_search_result',
515                          'complexType',
516                          'struct',
517                          'all',
518                           '',
519                         array(
520                                 'entry_list' => array('name' =>'entry_list', 'type'=>'tns:link_list'),
521                         )
522                 );
523
524                 $this->serviceClass->registerType(
525                          'get_entry_list_result_version2',
526                          'complexType',
527                          'struct',
528                          'all',
529                           '',
530                         array(
531                                 'result_count' => array('name'=>'result_count', 'type'=>'xsd:int'),
532                                 'next_offset' => array('name'=>'next_offset', 'type'=>'xsd:int'),
533                                 'entry_list' => array('name' =>'entry_list', 'type'=>'tns:entry_list'),
534                                 'relationship_list' => array('name' =>'relationship_list', 'type'=>'tns:link_lists'),
535                         )
536                 );
537                 
538                 $this->serviceClass->registerType(
539                          'get_server_info_result',
540                          'complexType',
541                          'struct',
542                          'all',
543                           '',
544                         array(
545                                 'flavor' => array('name'=>'id', 'type'=>'xsd:string'),
546                                 'version' => array('name'=>'id', 'type'=>'xsd:string'),
547                                 'gmt_time' => array('name'=>'id', 'type'=>'xsd:string'),
548                         )
549                 );
550                 
551                 $this->serviceClass->registerType(
552                          'new_set_entry_result',
553                          'complexType',
554                          'struct',
555                          'all',
556                           '',
557                         array(
558                                 'id' => array('name'=>'id', 'type'=>'xsd:string'),
559                         )
560                 );
561                 
562                 $this->serviceClass->registerType(
563                          'new_set_entries_result',
564                          'complexType',
565                          'struct',
566                          'all',
567                           '',
568                         array(
569                                 'ids' => array('name'=>'ids', 'type'=>'tns:select_fields'),
570                         )
571                 );
572                 
573                 $this->serviceClass->registerType(
574                     'new_set_relationhip_ids',
575                         'complexType',
576                          'array',
577                          '',
578                           'SOAP-ENC:Array',
579                         array(),
580                     array(
581                         array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:select_fields[]')
582                     ),
583                         'tns:select_fields'
584                 );
585                 
586                 $this->serviceClass->registerType(
587                          'new_set_relationship_list_result',
588                          'complexType',
589                          'struct',
590                          'all',
591                           '',
592                         array(
593                                 'created' => array('name'=>'created', 'type'=>'xsd:int'),
594                                 'failed' => array('name'=>'failed', 'type'=>'xsd:int'),
595                                 'deleted' => array('name'=>'deleted', 'type'=>'xsd:int'),
596                         )
597                 );
598                 
599                 $this->serviceClass->registerType(
600                     'document_revision',
601                     'complexType',
602                     'struct',
603                     'all',
604                     '',
605                     array(
606                         "id" => array('name'=>"id",'type'=>'xsd:string'),
607                                 "document_name" => array('name'=>"document_name",'type'=>'xsd:string'),
608                                 "revision" => array('name' => "revision", 'type'=>'xsd:string'),
609                                 "filename" => array('name' => "filename", 'type'=>'xsd:string'),
610                                 "file" => array('name'=>"file",'type'=>'xsd:string'),
611                     )
612                 );
613
614                 $this->serviceClass->registerType(
615                     'new_return_document_revision',
616                     'complexType',
617                     'struct',
618                     'all',
619                     '',
620                     array(
621                         "document_revision"=>array('name'=>'document_revision', 'type'=>'tns:document_revision'),
622                     )
623                 );
624
625                 
626                 $this->serviceClass->registerType(
627                     'module_list',
628                         'complexType',
629                          'struct',
630                          'all',
631                           '',
632                                 array(
633                                         'modules'=>array('name'=>'modules', 'type'=>'tns:select_fields'),
634                                 )
635                 );
636                 
637                 $this->serviceClass->registerType(
638                          'get_entries_count_result',
639                          'complexType',
640                          'struct',
641                          'all',
642                           '',
643                         array(
644                                 'result_count'=>array('name'=>'result_count', 'type'=>'xsd:int'),
645                         )
646                 );
647                                 
648                 
649                 $GLOBALS['log']->info('End: registry->registerTypes');
650
651                 // END OF REGISTER COMPLEX TYPES
652         } // fn
653 } // clazz