[Mapbender-commits] r9506 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jun 6 05:37:30 PDT 2016


Author: armin11
Date: 2016-06-06 05:37:29 -0700 (Mon, 06 Jun 2016)
New Revision: 9506

Modified:
   trunk/mapbender/http/classes/class_iso19139.php
Log:
Fix parsing of metadataurl tags for wfs2.0.0 - differs from older implementation specs

Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php	2016-06-03 12:27:34 UTC (rev 9505)
+++ trunk/mapbender/http/classes/class_iso19139.php	2016-06-06 12:37:29 UTC (rev 9506)
@@ -1627,7 +1627,7 @@
 				}
 			}	
 		}
-		$e = new mb_exception("iso19139 license id: ".$this->termsOfUseRef);
+		//$e = new mb_exception("iso19139 license id: ".$this->termsOfUseRef);
 		if ($licenseId !== null) {
 			$sql = <<<SQL
 			INSERT INTO md_termsofuse (fkey_termsofuse_id, fkey_metadata_id) VALUES ($1, $2);
@@ -1834,6 +1834,21 @@
 		$json .= "]}";
 		return $json;
 	}
+
+	private function getWfsVersionForFeaturetype($featuretypeId) {
+		$sql = "SELECT wfs.wfs_version FROM wfs_featuretype INNER JOIN wfs ON wfs_featuretype.fkey_wfs_id = wfs.wfs_id WHERE wfs_featuretype.featuretype_id = $1";
+		$v = array($featuretypeId);
+		$t = array('i');
+		$res = db_prep_query($sql,$v,$t);
+		if (!$res) {
+			$e = new mb_exception("No wfs version found for featuretype with id:".$featuretypeId);
+			return false;
+		} else {
+			$row = db_fetch_assoc($res);
+			return $row['wfs_version'];
+		}
+	}
+
 	//TODO - maybe we will encode more things than only the url ;-)
 	private function jsonDecodeDownloadLinks($dlJson) {
 		$downloadLinks = json_decode($dlJson);
@@ -2043,7 +2058,17 @@
 				//following information must be given:
 				//randomId, href, format, type, origin, owner
 				//TODO: that empty identifier not identified - see comparing linkage
-				if ((($this->type == 'ISO19115:2003' || $this->type == 'ISO 19115:2003') && $this->format =='text/xml') || ($this->type == 'TC211' && $this->format =='text/xml') || (($this->type == 'ISO19115:2003' || $this->type == 'ISO 19115:2003') && ($this->format =='application/vnd.iso.19139+xml' || $this->format =='application/xml'))) {
+
+				//check wfs version - if 2.0.0 is format and type attributes
+				$wfs20 = false;
+				if ($resourceType == 'featuretype') {
+					if ($this->getWfsVersionForFeaturetype($resourceId) == '2.0.0') {
+						$wfs20 = true;
+						//$e = new mb_exception("wfs 2.0.0 found!");
+					}
+				}
+				
+				if ((($this->type == 'ISO19115:2003' || $this->type == 'ISO 19115:2003') && $this->format =='text/xml') || ($this->type == 'TC211' && $this->format =='text/xml') || (($this->type == 'ISO19115:2003' || $this->type == 'ISO 19115:2003') && ($this->format =='application/vnd.iso.19139+xml' || $this->format =='application/xml')) || $wfs20 == true) {
 					$e = new mb_notice("class_Iso19139:"."try to parse: ".$this->href);
 					$metadata = $this->createFromUrl($this->href); //will alter object itself
 					$e = new mb_notice("class_Iso19139:"."Metadata found: ".$this->metadata);
@@ -2065,6 +2090,9 @@
 					$this->harvestResult = 1;
 				} else {
 					$e = new mb_exception("class_Iso19139:"."MetadataURL format or type of following url is not supported: Format: ".$this->format." | type: ".$this->type);
+					$result['value'] = false;
+					$result['message'] = "Metadata attributes are not set properly. Please check this configuration in the service!";
+					return $result;
 				}
 				break;
 			case "external":



More information about the Mapbender_commits mailing list