Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
soap_api_link_service.inc
1 <?php
18 require_once SQ_PACKAGES_PATH.'/web_services/api/soap_api/soap_api.inc';
19 
31 class Soap_Api_Link_Service extends Soap_Api
32 {
33 
34 
41  function __construct($assetid=0)
42  {
43  parent::__construct($assetid);
44 
45  }//end constructor
46 
47 
55  public function getFunctionList()
56  {
57  return Array(
58  'CreateAssetLink' => '1',
59  'DeleteAssetLink' => '1',
60  'GetAllChildLinks' => '1',
61  'GetChildren' => '1',
62  'GetDependantChildren' => '1',
63  'GetDependantParents' => '1',
64  'GetLinks' => '1',
65  'GetLinkByAsset' => '1',
66  'GetLinkLineages' => '1',
67  'GetParents' => '1',
68  'GetParentsUnderTree' => '1',
69  'MoveLink' => '1',
70  'UpdateLink' => '1',
71  );
72 
73  }//end getFunctionList()
74 
75 
96  function CreateAssetLink($request)
97  {
98  $request_info = (Array) $request;
99  $majorid = array_get_index($request_info, 'MajorID', '');
100  $minorid = array_get_index($request_info, 'MinorID', '');
101  $link_type = array_get_index($request_info, 'LinkType', '1');
102  $link_value = array_get_index($request_info, 'LinkValue', '');
103  $sort_order = self::getNullIndex($request_info, 'SortOrder', NULL);
104  $is_dependant = self::getBooleanIndex($request_info, 'IsDependant', 0);
105  $is_exclusive = self::getBooleanIndex($request_info, 'IsExclusive', 0);
106 
107  if (!empty($majorid) && !empty($minorid) && !empty($link_type)) {
108  $major = $GLOBALS['SQ_SYSTEM']->am->getAsset($majorid);
109  $minor = $GLOBALS['SQ_SYSTEM']->am->getAsset($minorid);
110  $new_link_id = $GLOBALS['SQ_SYSTEM']->am->createAssetLink($major, $minor, $link_type, $link_value, $sort_order, $is_dependant, $is_exclusive);
111  if ($new_link_id == 0) {
112  throw new SoapFault('Server', 'Unable to create link');
113  }//end if
114 
115  $this->updateLookupsforAsset($minorid);
116 
117  return Array (
118  'CreateAssetLinkResult' => $new_link_id,
119  );
120  } else {
121  throw new SoapFault('Server', 'Missing information to create link. Make sure MajorID, MinorID and LinkType is provided');
122  }//end else
123 
124  }//end CreateAssetLink()
125 
126 
140  function DeleteAssetLink($request)
141  {
142  $request_info = (Array) $request;
143  $linkid = array_get_index($request_info, 'LinkID', '');
144 
145  if (!empty($linkid)) {
146  $link = $GLOBALS['SQ_SYSTEM']->am->getLinkById($linkid);
147  if (!empty($link)) {
148  $GLOBALS['SQ_SYSTEM']->am->acquireLock($link['majorid'], 'all');
149  $GLOBALS['SQ_SYSTEM']->am->acquireLock($link['minorid'], 'all');
150  $significant_parent_links = $GLOBALS['SQ_SYSTEM']->am->getLinks($link['minorid'], SQ_SC_LINK_SIGNIFICANT, '', TRUE, 'minor');
151  if (count($significant_parent_links) > 1) {
152  // More than one parent link, we can delete the link
153  $result = $GLOBALS['SQ_SYSTEM']->am->deleteAssetLink($linkid);
154  } else {
155  // Only one link holly cow, lets trash it instead, otherwise we'l have an orphan asset in the system
156  $result = $GLOBALS['SQ_SYSTEM']->am->trashAsset($link['minorid']);
157  }//end if
158 
159  $this->updateLookupsforAsset($link['minorid']);
160 
161  $GLOBALS['SQ_SYSTEM']->am->releaseLock($link['minorid'], 'all');
162  $GLOBALS['SQ_SYSTEM']->am->releaseLock($link['majorid'], 'all');
163 
164  if ($result) {
165  return Array (
166  'DeleteAssetLinkResult' => $result,
167  );
168  } else {
169  throw new SoapFault('Server', 'Unable To Delete Link');
170  }//end else
171  } else {
172  throw new SoapFault('Server', 'There no such link with the Link ID provided');
173  }//end
174 
175  } else {
176  throw new SoapFault('Server', 'The Link ID Provided Is Empty');
177  }//end else
178 
179  }//end DeleteAssetLink()
180 
181 
198  function GetAllChildLinks($request)
199  {
200  $request_info = (Array) $request;
201  $assetid = array_get_index($request_info, 'AssetID', '');
202  $link_type = array_get_index($request_info, 'LinkType', 0);
203  if (!empty($assetid)) {
204  $all_child_links = $GLOBALS['SQ_SYSTEM']->am->getAllChildLinks($assetid, $link_type);
205  $link_results = Array();
206  $i = 0;
207  foreach ($all_child_links as $treeid => $link_info) {
208  $link_results[$i]['TreeID'] = $treeid;
209  $link_results[$i]['Level'] = $link_info['lvl'];
210  $link_results[$i]['LinkID'] = $link_info['linkid'];
211  $link_results[$i]['AssetID'] = $link_info['assetid'];
212  $link_results[$i]['TypeCode'] = $link_info['type_code'];
213  $link_results[$i]['LinkType'] = $link_info['link_type'];
214  $link_results[$i]['SortOrder'] = $link_info['sort_order'];
215  $link_results[$i]['Value'] = ($link_info['value'] === NULL) ? '' : $link_info['value'];
216  $link_results[$i]['IsDependant'] = $link_info['is_dependant'];
217  $link_results[$i]['IsExclusive'] = $link_info['is_exclusive'];
218  $link_results[$i]['DependantTreeID'] = $link_info['dependant_treeid'];
219  $i++;
220  }//end foreach
221 
222  return Array (
223  'GetAllChildLinksResult' => $link_results,
224  );
225  } else {
226  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
227  }//end else
228 
229  }//end GetAllChildLinks()
230 
231 
247  function GetDependantChildren($request)
248  {
249  $request_info = (Array) $request;
250  $assetid = array_get_index($request_info, 'AssetID', '');
251  $type_code = array_get_index($request_info, 'TypeCode', '');
252  $strict_type_code = self::getBooleanIndex($request_info, 'StrictTypeCode', TRUE);
253 
254  if (!empty($assetid)) {
255  $dependant_children = $GLOBALS['SQ_SYSTEM']->am->getDependantChildren($assetid, $type_code, $strict_type_code);
256  $dependant_results = Array();
257  $i = 0;
258  foreach ($dependant_children as $dependant_assetid => $type_code_info) {
259  $dependant_results[$i]['AssetID'] = $dependant_assetid;
260  $dependant_results[$i]['TypeCode'] = $type_code_info[0]['type_code'];
261  $i++;
262  }//end foreach
263 
264  return Array(
265  'GetDependantChildrenResult' => $dependant_results,
266  );
267  } else {
268  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
269  }//end else
270  }//end GetDependantChildren()
271 
272 
289  function GetDependantParents($request)
290  {
291  $request_info = (Array) $request;
292  $assetid = array_get_index($request_info, 'AssetID', '');
293  $type_code = array_get_index($request_info, 'TypeCode', '');
294  $strict_type_code = self::getBooleanIndex($request_info, 'StrictTypeCode', TRUE);
295  $include_all_dependants = self::getBooleanIndex($request_info, 'IncludeAllDependants', TRUE);
296 
297  $dependant_results = Array();
298  if (!empty($assetid)) {
299  $dependant_parents = $GLOBALS['SQ_SYSTEM']->am->getDependantParents($assetid, $type_code, $strict_type_code, $include_all_dependants);
300  $i = 0;
301  foreach ($dependant_parents as $dependant_assetid) {
302  $dependant_results[$i]['AssetID'] = $dependant_assetid;
303  $i++;
304  }//end foreach
305 
306  return Array(
307  'GetDependantParentsResult' => $dependant_results,
308  );
309  } else {
310  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
311  }//end else
312 
313  }//end GetDependantParents()
314 
315 
339  function GetLinks($request)
340  {
341  $request_info = (Array) $request;
342  $assetid = array_get_index($request_info, 'AssetID', '');
343  $link_type = array_get_index($request_info, 'LinkType', 1);
344  $type_code = array_get_index($request_info, 'TypeCode', '');
345  $strict_type_code = self::getBooleanIndex($request_info, 'StrictTypeCode', TRUE);
346  $side_of_link = array_get_index($request_info, 'SideOfLink', 'major');
347  $value = self::getNullIndex($request_info, 'LinkValue', NULL);
348  $dependant = self::getNullIndex($request_info, 'Dependant', NULL);
349  $exclusive = self::getNullIndex($request_info, 'Exclusive', NULL);
350  $sort_by = self::getNullIndex($request_info, 'SortBy', NULL);
351  $access = self::getNullIndex($request_info, 'PermissionLevel', NULL);
352  $effective = self::getBooleanIndex($request_info, 'Effective', TRUE);
353 
354  $access = self::getPermValue($access);
355  if (!empty($assetid)) {
356  $links = $GLOBALS['SQ_SYSTEM']->am->getLinks($assetid, $link_type, $type_code, $strict_type_code, $side_of_link, $value, $dependant, $exclusive, $sort_by, $access, $effective);
357 
358  if (!empty($links)) {
359  $link_results = Array();
360  $other_side_of_link = $side_of_link == 'major' ? 'minor' : 'major';
361  $i = 0;
362  foreach ($links as $link_info) {
363  $link_results[$i][ucwords($other_side_of_link).'ID'] = $link_info[$other_side_of_link.'id'];
364  $link_results[$i]['LinkID'] = $link_info['linkid'];
365  $link_results[$i]['Value'] = ($link_info['value'] === NULL) ? '' : $link_info['value'];
366  $link_results[$i]['LinkType'] = $link_info['link_type'];
367  $link_results[$i][ucwords($other_side_of_link).'TypeCode'] = $link_info[$other_side_of_link.'_type_code'];
368  $link_results[$i]['SortOrder'] = $link_info['sort_order'];
369  $link_results[$i]['IsDependant'] = $link_info['is_dependant'];
370  $link_results[$i]['IsExclusive'] = $link_info['is_exclusive'];
371  $i++;
372  }//end foreach
373  return Array (
374  'GetLinksResult' => $link_results,
375  );
376  } else {
377  throw new SoapFault('Server', 'There is no links for the specified criterions');
378  }//end else
379  } else {
380  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
381  }//end else
382 
383  }//end GetLinks()
384 
385 
402  function MoveLink($request)
403  {
404  $request_info = (Array) $request;
405  $linkid = array_get_index($request_info, 'LinkID', '');
406  $link_type = array_get_index($request_info, 'LinkType', 0);
407  $to_parent_id = array_get_index($request_info, 'ToParentID', 0);
408  $to_parent_position = array_get_index($request_info, 'ToParentPosition', 0);
409 
410  if (!empty($linkid) && !empty($to_parent_id)) {
411  $new_link_id = $GLOBALS['SQ_SYSTEM']->am->moveLink($linkid, $to_parent_id, $link_type, $to_parent_position);
412 
413  $new_link = $GLOBALS['SQ_SYSTEM']->am->getLinkById($new_link_id);
414  $minorid = array_get_index($new_link, 'minorid', '');
415  $this->updateLookupsforAsset($minorid);
416 
417  if (!empty($new_link_id)) {
418  return Array (
419  'MoveLinkResult' => $new_link_id,
420  );
421  } else {
422  throw new SoapFault('Server', 'Unable To Move Link');
423  }//end else
424  } else {
425  throw new SoapFault('Server', 'Either Link ID or ToParentID is invalid. Please provide valid LinkID and ToParentID');
426  }//end else
427 
428  }//end MoveLink()
429 
430 
447  function UpdateLink($request)
448  {
449  $request_info = (Array) $request;
450  $linkid = array_get_index($request_info, 'LinkID', '');
451  $link_type = self::getNullIndex($request_info, 'LinkType', NULL);
452  $link_value = self::getNullIndex($request_info, 'LinkValue', NULL);
453  $sort_order = self::getNullIndex($request_info, 'SortOrder', NULL);
454 
455  if (!empty($linkid)) {
456  $new_link_id = $GLOBALS['SQ_SYSTEM']->am->updateLink($linkid, $link_type, $link_value, $sort_order);
457 
458  if (!empty($new_link_id)) {
459  return Array (
460  'UpdateLinkResult' => $new_link_id,
461  );
462  } else {
463  throw new SoapFault('Server', 'Unable To Update Link');
464  }//end else
465  } else {
466  throw new SoapFault('Server', 'Link ID is not valid. Please provide a valid Link ID');
467  }//end else
468 
469  }//end UpdateLink()
470 
471 
495  function GetChildren($request)
496  {
497  $request_info = (Array) $request;
498  $assetid = array_get_index($request_info, 'AssetID', '');
499  $type_code = array_get_index($request_info, 'TypeCode', '');
500  $strict_type_code = self::getBooleanIndex($request_info, 'StrictTypeCode', TRUE);
501  $dependant = self::getNullIndex($request_info, 'Dependant', NULL);
502  $sort_by = self::getNullIndex($request_info, 'SortBy', NULL);
503  $access = self::getNullIndex($request_info, 'PermissionLevel', NULL);
504  $effective = self::getBooleanIndex($request_info, 'EffectiveAccess', TRUE);
505  $min_depth = self::getNullIndex($request_info, 'MinDepth', NULL);
506  $max_depth = self::getNullIndex($request_info, 'MaxDepth', NULL);
507  $direct_shadow_only = self::getBooleanIndex($request_info, 'DirectShadowsOnly', TRUE);
508  $link_value_wanted = self::getNullIndex($request_info, 'LinkValueWanted', NULL);
509 
510  $access = self::getPermValue($access);
511  if (!empty($assetid)) {
512  $children = $GLOBALS['SQ_SYSTEM']->am->getChildren($assetid, $type_code, $strict_type_code, $dependant, $sort_by, $access, $effective, $min_depth, $max_depth, $direct_shadow_only, $link_value_wanted);
513  $children_result = Array();
514  $i = 0;
515  foreach ($children as $child_assetid => $child_type_code_info) {
516  if (!is_null($sort_by)) {
517  $children_result[$i]['AssetID'] = $child_assetid;
518  $children_result[$i]['TypeCode'] = $child_type_code_info;
519  } else {
520  $children_result[$i]['AssetID'] = $child_assetid;
521  $children_result[$i]['TypeCode'] = $child_type_code_info[0]['type_code'];
522  }//end if
523  $i++;
524  }//end foreach
525 
526  return Array (
527  'GetChildrenResult' => $children_result,
528  );
529  } else {
530  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
531  }//end else
532 
533  }//end GetChildren()
534 
535 
559  function GetParents($request)
560  {
561  $request_info = (Array) $request;
562  $assetid = array_get_index($request_info, 'AssetID', '');
563  $type_code = array_get_index($request_info, 'TypeCode', '');
564  $strict_type_code = self::getBooleanIndex($request_info, 'StrictTypeCode', TRUE);
565  $sort_by = self::getNullIndex($request_info, 'SortBy', NULL);
566  $access = self::getNullIndex($request_info, 'PermissionLevel', NULL);
567  $effective = self::getBooleanIndex($request_info, 'EffectiveAccess', TRUE);
568  $min_depth = self::getNullIndex($request_info, 'MinDepth', NULL);
569  $max_depth = self::getNullIndex($request_info, 'MaxDepth', NULL);
570  $ignore_bridge = self::getBooleanIndex($request_info, 'DirectShadowsOnly', FALSE);
571  $link_value_wanted = self::getNullIndex($request_info, 'LinkValueWanted', NULL);
572 
573  $access = self::getPermValue($access);
574  if (!empty($assetid)) {
575  $parents = $GLOBALS['SQ_SYSTEM']->am->getParents($assetid, $type_code, $strict_type_code, $sort_by, $access, $effective, $min_depth, $max_depth, $ignore_bridge, $link_value_wanted);
576  $parents_result = Array();
577  $i = 0;
578  foreach ($parents as $parent_assetid => $parent_type_code) {
579  $parents_result[$i]['AssetID'] = $parent_assetid;
580  $parents_result[$i]['TypeCode'] = $parent_type_code;
581  $i++;
582  }//end foreach
583  if (!empty($parents)) {
584  return Array (
585  'GetParentsResult' => $parents_result,
586  );
587  } else {
588  throw new SoapFault('Server', 'Unable To Get Parents');
589  }//end else
590  } else {
591  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
592  }//end else
593 
594  }//end findStatus()
595 
596 
603  function GetParentsUnderTree($request)
604  {
605  $request_info = (Array) $request;
606  $assetid = array_get_index($request_info, 'AssetID', '');
607  $rootid = array_get_index($request_info, 'RootID', '');
608  $minLevel = array_get_index($request_info, 'MinLevel', NULL);
609  $maxLevel = array_get_index($request_info, 'MaxLevel', NULL);
610 
611  if (!empty($assetid) && !empty($rootid)) {
612  $treeids = $GLOBALS['SQ_SYSTEM']->am->getAssetTreeids($rootid);
613 
614  foreach ($treeids as $index => $treeid) {
615  $treeids[$index] = Array($treeid);
616  }//end foreach
617 
618  $lineages = $GLOBALS['SQ_SYSTEM']->am->getLinkLineages($assetid, 0, $treeids, 'name', TRUE);
619  $lineageResult = Array();
620 
621  foreach ($lineages as $lineageDetail) {
622  $parentAsset = Array();
623  foreach ($lineageDetail['lineage'] as $parentid => $parent_name) {
624  $parentAsset[] = Array (
625  'ParentID' => $parentid,
626  'ParentName' => $parent_name,
627  );
628  }//end foreach
629 
630  if (!is_null($minLevel) && !is_null($maxLevel)) {
631  // How to limit the min level.
632  $maxParentAsset = array_slice($parentAsset, (-1) * $maxLevel);
633  // Plus one because we want the min level as well.
634  $parentAsset = array_slice($maxParentAsset, 0, count($maxParentAsset) - $minLevel + 1);
635  }//end if
636 
637  $lineageResult[] = Array(
638  'LinkID' => $lineageDetail['linkid'],
639  'LinkType' => $lineageDetail['link_type'],
640  'ParentAssets' => $parentAsset,
641  );
642  }//end foreach
643 
644  return $lineageResult;
645 
646  } else {
647  throw new SoapFault('Server', 'Asset ID or Root ID is not valid. Please provide a valid Asset ID');
648  }//end else
649 
650  }//end GetParentsUnderTree()
651 
652 
672  function GetLinkByAsset($request)
673  {
674  $request_info = (Array) $request;
675  $assetid = array_get_index($request_info, 'AssetID', '');
676  $other_assetid = array_get_index($request_info, 'OtherAssetID', '');
677  $link_type = array_get_index($request_info, 'LinkType', NULL);
678  $link_value = array_get_index($request_info, 'LinkValue', NULL);
679  $side_of_link = array_get_index($request_info, 'SideOfLink', 'major');
680  $dependant = self::getNullIndex($request_info, 'IsDependant', NULL);
681  $exclusive = self::getNullIndex($request_info, 'IsExclusive', NULL);
682 
683  if (!empty($assetid)) {
684  $links = $GLOBALS['SQ_SYSTEM']->am->getLinkByAsset($assetid, $other_assetid, $link_type, $link_value, $side_of_link, TRUE, $dependant, $exclusive);
685  if (!empty($links)) {
686  $link_results = Array();
687  $i = 0;
688  $other_side_of_link = $side_of_link == 'major' ? 'minor' : 'major';
689  foreach ($links as $link_info) {
690  $link_results[$i][ucwords($other_side_of_link).'ID'] = $link_info[$other_side_of_link.'id'];
691  $link_results[$i]['LinkID'] = $link_info['linkid'];
692  $link_results[$i]['Value'] = ($link_info['value'] === NULL) ? '' : $link_info['value'];
693  $link_results[$i]['LinkType'] = $link_info['link_type'];
694  $link_results[$i][ucwords($other_side_of_link).'TypeCode'] = $link_info[$other_side_of_link.'_type_code'];
695  $link_results[$i]['SortOrder'] = $link_info['sort_order'];
696  $link_results[$i]['IsDependant'] = $link_info['is_dependant'];
697  $link_results[$i]['IsExclusive'] = $link_info['is_exclusive'];
698  $i++;
699  }//end foreach
700 
701  return Array (
702  'GetLinkByAssetResult' => $link_results,
703  );
704  } else {
705  throw new SoapFault('Server', 'Unable To Get Link Between Assets');
706  }//end else
707  } else {
708  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
709 
710  }//end else
711 
712  }//end GetLinkByAsset()
713 
714 
721  function GetLinkLineages($request)
722  {
723  $request_info = (Array) $request;
724  $assetid = array_get_index($request_info, 'AssetID', '');
725  $root_assetid = array_get_index($request_info, 'RootNode', '');
726 
727  if (!empty($assetid)) {
728  // Get the tree id of the rootnode.
729  $treeids = NULL;
730  if (!empty($root_assetid)) {
731  $treeids = $GLOBALS['SQ_SYSTEM']->am->getAssetTreeids($root_assetid);
732  foreach ($treeids as $index => $treeid) {
733  $treeids[$index] = Array($treeid);
734  }//end foreach
735  }//end if
736 
737  $lineages = $GLOBALS['SQ_SYSTEM']->am->getLinkLineages($assetid, 0, $treeids, 'name', TRUE);
738  $lineages_result = array();
739  foreach ($lineages as $lineage_info) {
740  $lineage_details = array();
741  $lineage_details['LinkID'] = $lineage_info['linkid'];
742  $lineage_details['LinkType'] = $lineage_info['link_type'];
743  $order = 0;
744  foreach ($lineage_info['lineage'] as $parentid => $parent_name) {
745  $one_lineage = array();
746  $one_lineage['AssetID'] = $parentid;
747  $one_lineage['AssetName'] = $parent_name;
748  $one_lineage['Order'] = $order;
749  $lineage_details['Lineage'][] = $one_lineage;
750  $order++;
751  }//end foreach
752 
753  $lineages_result[] = $lineage_details;
754  $lineage_details = array();
755  }//end foreach
756 
757  // Lineage details, lineages result, lineages details.
758 
759  } else {
760  throw new SoapFault('Server', 'Asset ID is not valid. Please provide a valid Asset ID');
761 
762  }//end else
763 
764  return Array (
765  'GetLinkLineagesResult' => $lineages_result,
766  );
767 
768  }//end GetLinkLineages()
769 
770 
777  public static function getComplexElements($func_list=Array())
778  {
779  $obj_optional = self::getArgType('AssetObject', 0, 1);
780  $link_details = self::getArgType('LinkDetails', 0, 'unbounded', TRUE);
781  $link_info_summary = self::getArgType('LinkInfoSummary', 0, 'unbounded', TRUE);
782  $children_info_summary = self::getArgType('ChildrenInfoSummary', 0, 'unbounded', TRUE);
783  $link_type = self::getArgType('LinkTypeValue', 0, 1);
784  $asset_types = self::getArgType('AssetType', 0, 1);
785  $link_type = self::getArgType('LinkTypeValue', 0, 1);
786  $lineages_details = self::getArgType('LineagesDetails', 0, 'unbounded');
787  $parent_path_details = self::getArgType('ParentPathsDetails', 0, 'unbounded');
788 
789  $complex_types = Array (
790  'CreateAssetLink' => Array (
791  'CreateAssetLink' => Array (
792  'MajorID' => self::$string_non_optional,
793  'MinorID' => self::$string_non_optional,
794  'LinkType' => $link_type,
795  'LinkValue' => self::$string_optional,
796  'SortOrder' => self::$string_optional,
797  'IsDependant' => self::$string_optional,
798  'IsExclusive' => self::$string_optional,
799  ),
800  'CreateAssetLinkResponse' => Array (
801  'CreateAssetLinkResult' => self::$string_optional,
802  ),
803  ),
804  'DeleteAssetLink' => Array (
805  'DeleteAssetLink' => Array (
806  'LinkID' => self::$string_non_optional,
807  ),
808  'DeleteAssetLinkResponse' => Array (
809  'DeleteAssetLinkResult' => self::$boolean_optional,
810  ),
811  ),
812  'GetAllChildLinks' => Array (
813  'GetAllChildLinks' => Array (
814  'AssetID' => self::$string_non_optional,
815  'LinkType' => $link_type,
816  ),
817  'GetAllChildLinksResponse' => Array (
818  'GetAllChildLinksResult' => $link_details,
819  ),
820  ),
821  'GetChildren' => Array (
822  'GetChildren' => Array (
823  'AssetID' => self::$string_non_optional,
824  'TypeCode' => self::$string_non_optional,
825  'StrictTypeCode' => self::$string_optional,
826  'Dependant' => self::$string_optional,
827  'SortBy' => self::$string_optional,
828  'PermissionLevel' => self::$string_optional,
829  'EffectiveAccess' => self::$string_optional,
830  'MinDepth' => self::$string_optional,
831  'MaxDepth' => self::$string_optional,
832  'DirectShadowsOnly' => self::$string_optional,
833  'LinkValueWanted' => self::$string_optional,
834  ),
835  'GetChildrenResponse' => Array (
836  'GetChildrenResult' => $children_info_summary,
837  ),
838  ),
839  'GetDependantChildren' => Array (
840  'GetDependantChildren' => Array (
841  'AssetID' => self::$string_non_optional,
842  'TypeCode' => $asset_types,
843  'StrictTypeCode' => self::$boolean_optional,
844  ),
845  'GetDependantChildrenResponse' => Array (
846  'GetDependantChildrenResult' => $link_info_summary,
847 
848  ),
849  ),
850  'GetDependantParents' => Array (
851  'GetDependantParents' => Array (
852  'AssetID' => self::$string_non_optional,
853  'TypeCode' => self::$string_optional,
854  'StrictTypeCode' => self::$boolean_optional,
855  'IncludeAllDependants' => self::$boolean_optional,
856  ),
857  'GetDependantParentsResponse' => Array (
858  'GetDependantParentsResult' => $link_info_summary,
859  ),
860  ),
861  'GetLinks' => Array (
862  'GetLinks' => Array (
863  'AssetID' => self::$string_non_optional,
864  'LinkType' => $link_type,
865  'TypeCode' => $asset_types,
866  'StrictTypeCode' => self::$boolean_optional,
867  'SideOfLink' => self::$string_optional,
868  'LinkValue' => self::$string_optional,
869  'Dependant' => self::$boolean_optional,
870  'Exclusive' => self::$boolean_optional,
871  'SortBy' => self::$string_optional,
872  'PermissionLevel' => self::$string_optional,
873  'Effective' => self::$boolean_optional,
874  ),
875  'GetLinksResponse' => Array (
876  'GetLinksResult' => $link_details,
877  ),
878  ),
879  'GetLinkByAsset' => Array (
880  'GetLinkByAsset' => Array (
881  'AssetID' => self::$string_non_optional,
882  'OtherAssetID' => self::$string_non_optional,
883  'LinkType' => $link_type,
884  'LinkValue' => self::$string_optional,
885  'SideOfLink' => self::$string_optional,
886  'IsDependant' => self::$boolean_optional,
887  'IsExclusive' => self::$boolean_optional,
888  ),
889  'GetLinkByAssetResponse' => Array (
890  'GetLinkByAssetResult' => $link_details,
891  ),
892  ),
893  'GetLinkLineages' => Array (
894  'GetLinkLineages' => Array (
895  'AssetID' => self::$string_non_optional,
896  'RootNode' => self::$string_optional,
897  ),
898  'GetLinkLineagesResponse' => Array (
899  'GetLinkLineagesResult' => $lineages_details,
900  ),
901  ),
902  'MoveLink' => Array (
903  'MoveLink' => Array (
904  'LinkID' => self::$string_non_optional,
905  'LinkType' => $link_type,
906  'ToParentID' => self::$string_optional,
907  'ToParentPosition' => self::$string_optional,
908  ),
909  'MoveLinkResponse' => Array (
910  'MoveLinkResult' => self::$int_optional,
911  ),
912  ),
913  'UpdateLink' => Array (
914  'UpdateLink' => Array (
915  'LinkID' => self::$string_non_optional,
916  'LinkType' => $link_type,
917  'LinkValue' => self::$string_optional,
918  'SortOrder' => self::$string_optional,
919  ),
920  'UpdateLinkResponse' => Array (
921  'UpdateLinkResult' => self::$string_optional,
922  ),
923  ),
924  'GetParents' => Array (
925  'GetParents' => Array (
926  'AssetID' => self::$string_non_optional,
927  'TypeCode' => $asset_types,
928  'StrictTypeCode' => self::$string_optional,
929  'SortBy' => self::$string_optional,
930  'PermissionLevel' => self::$string_optional,
931  'Effective' => self::$string_optional,
932  'MinDepth' => self::$string_optional,
933  'MaxDepth' => self::$string_optional,
934  'DirectShadowOnly' => self::$string_optional,
935  'LinkValueWanted' => self::$string_optional,
936 
937  ),
938  'GetParentsResponse' => Array (
939  'GetParentsResult' => $link_info_summary,
940  ),
941  ),
942  'GetParentsUnderTree' => Array (
943  'GetParentsUnderTree' => Array (
944  'AssetID' => self::$string_non_optional,
945  'RootID' => self::$string_non_optional,
946  'MinLevel' => self::$string_non_optional,
947  'MaxLevel' => self::$string_non_optional,
948  ),
949  'GetParentsUnderTreeResponse' => Array (
950  'ParentPaths' => $parent_path_details,
951  ),
952  ),
953  );
954 
955  $complex_types_available = parent::getComplexElements($complex_types);
956 
957  return $complex_types_available;
958 
959 
960  }//end getComplexElements();
961 
962 
969  public static function getComplexTypes($func_list=Array())
970  {
971  $link_details = Array (
972  'LinkDetails' => Array (
973  'TreeID' => self::$string_optional,
974  'LinkID' => self::$string_non_optional,
975  'Level' => self::$string_optional,
976  'MinorID' => self::$string_optional,
977  'MajorID' => self::$string_optional,
978  'MinorTypeCode' => self::$string_optional,
979  'MajorTypeCode' => self::$string_optional,
980  'AssetID' => self::$string_optional,
981  'TypeCode' => self::$string_optional,
982  'LinkType' => self::$string_optional,
983  'SortOrder' => self::$string_optional,
984  'Value' => self::$string_optional,
985  'IsDependant' => self::$string_optional,
986  'IsExclusive' => self::$string_optional,
987  'DependantTreeID' => self::$string_optional,
988  ),
989  );
990  $lineages_details = self::getArgType('LineagesDetails', 0, 'unbounded');
991  $lineage = self::getArgType('Lineage', 0, 'unbounded');
992 
993  $lineages_details = Array (
994  'LineagesDetails' => Array (
995  'LinkID' => self::$string_non_optional,
996  'LinkType' => self::$string_non_optional,
997  'Lineage' => $lineage,
998  ),
999  'Lineage' => Array (
1000  'AssetID' => self::$string_non_optional,
1001  'AssetName' => self::$string_non_optional,
1002  'Order' => self::$int_non_optional,
1003  ),
1004  );
1005 
1006  $parent_list = self::getArgType('ParentAssets', 0, 'unbounded');
1007  $parent_paths_details = Array (
1008  'ParentPathsDetails' => Array (
1009  'LinkID' => self::$string_non_optional,
1010  'LinkType' => self::$string_non_optional,
1011  'ParentAssets' => $parent_list,
1012  ),
1013  'ParentAssets' => Array (
1014  'ParentID' => self::$string_non_optional,
1015  'ParentName' => self::$string_non_optional,
1016  ),
1017  );
1018 
1019  $complex_types = Array (
1020  'GetAllChildLinks' => $link_details,
1021  'GetLinks' => $link_details,
1022  'GetLinkByAsset' => $link_details,
1023  'GetLinkLineages' => $lineages_details,
1024  'GetParentsUnderTree' => $parent_paths_details,
1025  'GetDependantParents' => Array (
1026  'LinkInfoSummary' => Array (
1027  'AssetID' => self::$string_non_optional,
1028  'TypeCode' => self::$string_optional,
1029  ),
1030  ),
1031  'GetChildren' => Array (
1032  'ChildrenInfoSummary' => Array (
1033  'AssetID' => self::$string_non_optional,
1034  'TypeCode' => self::$string_non_optional,
1035  ),
1036  ),
1037  );
1038 
1039  $complex_types_available = parent::getComplexElements($complex_types);
1040 
1041  return $complex_types_available;
1042 
1043  }//end getComplexTypes()
1044 
1045 
1052  public static function getSimpleRestrictedTypes($func_list=Array())
1053  {
1054  $asset_types_info = $GLOBALS['SQ_SYSTEM']->am->getAssetTypes(TRUE, TRUE);
1055  $asset_types = Array();
1056  foreach ($asset_types_info as $asset_type_info) {
1057  $asset_types[] = $asset_type_info['type_code'];
1058  }//end foreach
1059 
1060  $common_types = Array (
1061  'LinkTypeValue' => Array (
1062  'restriction_base' => 'string',
1063  'enumeration' => Array (
1064  '1', '2', '4', '8'
1065  ),
1066  ),
1067  );
1068 
1069 
1070  $simple_restricted_types = Array (
1071  'CreateAssetLink' => Array (
1072  'LinkTypeValue' => $common_types['LinkTypeValue'],
1073  ),
1074  'GetLinks' => Array (
1075  'LinkTypeValue' => $common_types['LinkTypeValue'],
1076  'AssetType' => Array (
1077  'restriction_base' => 'string',
1078  'enumeration' => $asset_types,
1079  ),
1080  ),
1081  'MoveLink' => Array (
1082  'LinkTypeValue' => $common_types['LinkTypeValue'],
1083  ),
1084  'UpdateLink' => Array (
1085  'LinkTypeValue' => $common_types['LinkTypeValue'],
1086  ),
1087  'GetLinkByAsset' => Array (
1088  'LinkTypeValue' => $common_types['LinkTypeValue'],
1089  ),
1090  'GetAllChildLinks' => Array (
1091  'LinkTypeValue' => $common_types['LinkTypeValue'],
1092  ),
1093  'GetChildren' => Array (
1094  'AssetType' => Array (
1095  'restriction_base' => 'string',
1096  'enumeration' => $asset_types,
1097  ),
1098  ),
1099  'GetDependantChildren' => Array (
1100  'AssetType' => Array (
1101  'restriction_base' => 'string',
1102  'enumeration' => $asset_types,
1103  ),
1104  ),
1105  'GetDependantParents' => Array (
1106  'AssetType' => Array (
1107  'restriction_base' => 'string',
1108  'enumeration' => $asset_types,
1109  ),
1110  ),
1111  'GetParents' => Array (
1112  'AssetType' => Array (
1113  'restriction_base' => 'string',
1114  'enumeration' => $asset_types,
1115  ),
1116  ),
1117  );
1118 
1119  $simple_restricted_types_available = parent::processSimpleRestrictedTypes($simple_restricted_types);
1120 
1121  return $simple_restricted_types_available;
1122 
1123  }//end getSimpleRestrictedTypes()
1124 
1125 
1134  private static function getPermValue($permission)
1135  {
1136  $perm_level = Array (
1137  'Read' => '1',
1138  'Write' => '2',
1139  'Admin' => '3',
1140  );
1141  if (empty($permission) || !isset($perm_level[$permission])) return NULL;
1142 
1143  return $perm_level[$permission];
1144 
1145  }//end getPermValue()
1146 
1147 }//end class
1148 ?>