فهرست منبع

added resolveDepth in WfsBiAudit for base items

Piotr Labudda 8 سال پیش
والد
کامیت
4b4b6b348a
1فایلهای تغییر یافته به همراه25 افزوده شده و 7 حذف شده
  1. 25 7
      SE/se-lib/Route/WfsBiAudit.php

+ 25 - 7
SE/se-lib/Route/WfsBiAudit.php

@@ -231,7 +231,8 @@ public function objectStructView($item) {
 					$dataNode = $featureNode,
 					$typeName = "default_db__x3A__{$row['REMOTE_TABLE']}:{$row['REMOTE_TABLE']}",
 					$primaryKey = $row['REMOTE_ID'],
-					$skipFields = [ 'ID' ]
+					$skipFields = [ 'ID' ],
+					$resolveDepth - 1
 				);
 			} else {
 				$xlink = $this->addChild($node, "default_db__x3A__{$row['REMOTE_TABLE']}:{$row['REMOTE_TABLE']}");
@@ -241,14 +242,29 @@ public function objectStructView($item) {
 		}
 	}
 
-	public function addAclInfo($dataNode, $typeName, $primaryKey, $skipFields = []) {
+	public function addAclInfo($dataNode, $typeName, $primaryKey, $skipFields = [], $resolveDepth = 0) {
 		try {
 			$acl = ACL::getAclByTypeName($typeName);
 			list($nsPrefix, $nsBaseName) = explode(':', $typeName);
 			// list($nsSourceName, $nsBaseTable) = explode('__x3A__', $nsPrefix);
-			$item = $acl->buildQuery([
-				'cols' => array_values($acl->getFieldListByIdZasob()),
-			])->getItem($primaryKey);
+			$searchParams = [
+				'cols' => array_values($acl->getFieldListByIdZasob())
+			];
+			// echo "TODO: \$typeName({$typeName}) \$resolveDepth({$resolveDepth})\n";
+			if ($resolveDepth > 0) {
+				$filterFields = implode("/", array_fill(0, $resolveDepth + 1, "*"));
+				// echo "TODO: \$typeName({$typeName}) \$resolveDepth({$resolveDepth}) \$filterFields({$filterFields})\n";
+				$schemaCache = array();
+				try {
+					Lib::loadClass('Api_Wfs_GetFeature');
+					$searchParams['cols'] = Api_Wfs_GetFeature::convertOgcPropertyListToFeatureQueryCols($schemaCache, [ $filterFields ], $acl, $isRoot = $args['root']); // convert $args['filterFields'] to field list
+					// print_r($searchParams);
+				} catch (Exception $e) {
+					DBG::log($e);
+					throw $e;
+				}
+			}
+			$item = $acl->buildQuery($searchParams)->getItem($primaryKey);
 			if (!$item) throw new \Exception("Item not found {$primaryKey}");
 			// $item = Array( [ID] => 56977, [krs] => 0000080725 , ... )
 			// $item[default_db__x3A__BI_audit_MSIG_address:BI_audit_MSIG_address] => Array( [0] => [ 'xlink' => ${url} ] )
@@ -262,6 +278,7 @@ public function objectStructView($item) {
 			//                     [@maxFeatures] => 10
 			//                     [value] => https://biuro.biall-net.pl/dev-pl/se-master/index.php?SERVICE=WFS&VERSION=1.0.0&TYPENAME=default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person&REQUEST=GetFeature&backRefNS=default_db/BI_audit_KRS/BI_audit_KRS&backRefPK=56977&backRefField=default_db__x3A__BI_audit_KRS_person:BI_audit_KRS_person&maxFeatures=10&startIndex=10
 			// $dataNode = $this->addChild($featureNode, "default_db__x3A__{$row['REMOTE_TABLE']}:{$row['REMOTE_TABLE']}");
+			DBG::log(['item'=>$item,'searchParams'=>$searchParams], 'array', "DBG WfsBiAudit \$item");
 			foreach ($item as $fieldName => $value) {
 				if (in_array($fieldName, $skipFields)) continue;
 				// $this->addAttribute($dataNode, 'xlink:href', "https://biuro.biall-net.pl/wfs/default_db/{$row['REMOTE_TABLE']}?BI_audit_ALL_ref_RELATIONS={$relation}#{$row['REMOTE_TABLE']}.{$row['REMOTE_ID']}");
@@ -286,7 +303,7 @@ public function objectStructView($item) {
 							$p5LinkNode = $this->addChild($dataNode, 'p5:links');
 							foreach ($refValue['p5:links'] as $p5LinkKey => $p5LinkValue) {
 								if ('p5:next' === $p5LinkKey) {
-									$p5NextLinkNode = $this->addChild($p5LinkNode, 'p5:next', $p5LinkValue['value']);
+									$p5NextLinkNode = $this->addChild($p5LinkNode, 'p5:next', str_replace('&', '&', $p5LinkValue['value']));
 									foreach ($p5LinkValue as $p5NextKey => $p5NextValue) {
 										if ('@' === $p5NextKey[0]) {
 											$this->addAttribute($p5NextLinkNode, "p5:" . substr($p5NextKey, 1), $p5NextValue);
@@ -359,7 +376,8 @@ public function objectStructView($item) {
 					$dataNode = $featureNode,
 					$typeName = $TYPENAME,
 					$primaryKey = $primaryKey,
-					$skipFields = []
+					$skipFields = [],
+					$resolveDepth
 				);
 
 				// foreach ($this->tablesUsed as $table) $this->addAttribute($wfs, "xmlns:default_db__x3A__{$table}", "https://biuro.biall-net.pl/wfs/default_db/{$table}");