|
@@ -755,7 +755,7 @@ if($DBG){echo 'L.' . __LINE__ . ' $convertedTransaction:';print_r($convertedTran
|
|
|
$changesList = array();
|
|
$changesList = array();
|
|
|
if (!empty($itemPatchs)) {
|
|
if (!empty($itemPatchs)) {
|
|
|
foreach ($itemPatchs as $itemPatchInfo) {
|
|
foreach ($itemPatchs as $itemPatchInfo) {
|
|
|
- if($DBG){echo "itemPatchInfo['itemPatch']:\n";print_r($itemPatchInfo['itemPatch']);}
|
|
|
|
|
|
|
+ if($DBG){echo "L." . __LINE__ . " itemPatchInfo['itemPatch']:\n";print_r($itemPatchInfo['itemPatch']);}
|
|
|
$acl = $this->getAclFromTypeName($itemPatchInfo['typeName']);
|
|
$acl = $this->getAclFromTypeName($itemPatchInfo['typeName']);
|
|
|
if ('Delete' == $itemPatchInfo['tag']) {
|
|
if ('Delete' == $itemPatchInfo['tag']) {
|
|
|
$itemPatch = array();
|
|
$itemPatch = array();
|
|
@@ -777,7 +777,7 @@ if($DBG){echo 'L.' . __LINE__ . ' $convertedTransaction:';print_r($convertedTran
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if($DBG){echo "TODO '" . ($itemPatchInfo['tag'])? 'Insert' : 'Update' . "' itemPatch:\n";print_r($itemPatch);}
|
|
|
|
|
|
|
+ if($DBG){echo "L." . __LINE__ . " TODO '" . ($itemPatchInfo['tag'])? 'Insert' : 'Update' . "' itemPatch:\n";print_r($itemPatch);}
|
|
|
if ('Insert' == $itemPatchInfo['tag'] && empty($itemPatch[$acl->getPrimaryKeyField()])) {
|
|
if ('Insert' == $itemPatchInfo['tag'] && empty($itemPatch[$acl->getPrimaryKeyField()])) {
|
|
|
$newId = $acl->addItem($itemPatch);
|
|
$newId = $acl->addItem($itemPatch);
|
|
|
$changesList[$newId] = array('Status'=>(($newId > 0)? 'SUCCESS' : 'FAILED'), 'Message'=>"created {$newId}.");
|
|
$changesList[$newId] = array('Status'=>(($newId > 0)? 'SUCCESS' : 'FAILED'), 'Message'=>"created {$newId}.");
|
|
@@ -1115,11 +1115,14 @@ if($DBG){echo 'L.' . __LINE__ . ' sourceNsList:';print_r($sourceNsList);echo "\n
|
|
|
$updateTypeNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:complexType');
|
|
$updateTypeNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:complexType');
|
|
|
$rootNode->appendChild($updateTypeNode);
|
|
$rootNode->appendChild($updateTypeNode);
|
|
|
$updateTypeNode->setAttribute('name', $updateElementType);
|
|
$updateTypeNode->setAttribute('name', $updateElementType);
|
|
|
|
|
+ {
|
|
|
$seqNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:all');
|
|
$seqNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:all');
|
|
|
$updateTypeNode->appendChild($seqNode);
|
|
$updateTypeNode->appendChild($seqNode);
|
|
|
-
|
|
|
|
|
|
|
+ {
|
|
|
$pKeyField = $acl->getPrimaryKeyField();
|
|
$pKeyField = $acl->getPrimaryKeyField();
|
|
|
$fldList = $this->_getFieldListFromAcl($acl);
|
|
$fldList = $this->_getFieldListFromAcl($acl);
|
|
|
|
|
+
|
|
|
|
|
+ // fields without geometry fields
|
|
|
foreach ($fldList as $fldName) {
|
|
foreach ($fldList as $fldName) {
|
|
|
if ($acl->isGeomField($fldName)) continue;
|
|
if ($acl->isGeomField($fldName)) continue;
|
|
|
|
|
|
|
@@ -1145,37 +1148,25 @@ if($DBG){echo 'L.' . __LINE__ . ' sourceNsList:';print_r($sourceNsList);echo "\n
|
|
|
$fldType = 'xsd:date';
|
|
$fldType = 'xsd:date';
|
|
|
}
|
|
}
|
|
|
else if ($acl->isDateTimeField($fldName)) {
|
|
else if ($acl->isDateTimeField($fldName)) {
|
|
|
- $fldType = 'xsd:dateTime';
|
|
|
|
|
- }
|
|
|
|
|
- else if ($acl->isGeomField($fldName)) {
|
|
|
|
|
- //$fldType = 'gml:GeometryPropertyType';
|
|
|
|
|
- // TODO: use geom types from gml to wkt
|
|
|
|
|
- // TODO: pattern wg atrybutów gml:coordinates decimal="." cs="," ts=" "
|
|
|
|
|
- $patternWkt = '';// TODO: error if empty - unsupported geom type
|
|
|
|
|
- $patternNum = '\-?\d+\.?\d*';
|
|
|
|
|
- $patternPoint = $patternNum . ',' . $patternNum;
|
|
|
|
|
- $patternPoints = '(' . $patternPoint . ')( ' . $patternPoint . ')+';
|
|
|
|
|
-
|
|
|
|
|
- $geomType = $acl->getGeomFieldType($fldName);
|
|
|
|
|
- if ('polygon' == $geomType) {
|
|
|
|
|
- // [a-zA-Z]+\(\((\-?\d+\.?\d*,\-?\d+\.?\d*)( (\-?\d+\.?\d*,\-?\d+\.?\d*))+\)\)
|
|
|
|
|
- $patternWkt = '[a-zA-Z]+\(\(' . $patternPoints . '\)\)';
|
|
|
|
|
- } else if ('linestring' == $geomType) {
|
|
|
|
|
- // [a-zA-Z]+\((\-?\d+\.?\d*,\-?\d+\.?\d*)( (\-?\d+\.?\d*,\-?\d+\.?\d*))+\)
|
|
|
|
|
- $patternWkt = '[a-zA-Z]+\(' . $patternPoints . '\)';
|
|
|
|
|
- } else if ('point' == $geomType) {
|
|
|
|
|
- // [a-zA-Z]+\(\-?\d\.?\d*,\-?\d\.?\d*\)
|
|
|
|
|
- $patternWkt = '[a-zA-Z]+\(' . $patternPoint . '\)';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // $fldType = 'xsd:dateTime';
|
|
|
|
|
+ $fldType = null;// 'xsd:string';
|
|
|
|
|
+ $patternDataTime = "(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})(:(\d{2}))?";
|
|
|
|
|
+ // <xsd:element name="..." minOccurs="0" nillable="true">
|
|
|
|
|
+ // <xsd:simpleType>
|
|
|
|
|
+ // <xsd:restriction base="xsd:string">
|
|
|
|
|
+ // <xsd:pattern value="[a-zA-Z]+\(\((\-?\d+\.?\d*,\-?\d+\.?\d*)( \-?\d+\.?\d*,\-?\d+\.?\d*)+\)\)"/>
|
|
|
|
|
+ // </xsd:restriction>
|
|
|
|
|
+ // </xsd:simpleType>
|
|
|
|
|
+ // </xsd:element>
|
|
|
$simpleTypeNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:simpleType');
|
|
$simpleTypeNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:simpleType');
|
|
|
$restrictionNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:restriction');
|
|
$restrictionNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:restriction');
|
|
|
$patternNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:pattern');
|
|
$patternNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:pattern');
|
|
|
$restrictionNode->setAttribute('base', 'xsd:string');
|
|
$restrictionNode->setAttribute('base', 'xsd:string');
|
|
|
- $patternNode->setAttribute('value', $patternWkt);
|
|
|
|
|
|
|
+ $patternNode->setAttribute('value', $patternDataTime);
|
|
|
$restrictionNode->appendChild($patternNode);
|
|
$restrictionNode->appendChild($patternNode);
|
|
|
$simpleTypeNode->appendChild($restrictionNode);
|
|
$simpleTypeNode->appendChild($restrictionNode);
|
|
|
$elNode->appendChild($simpleTypeNode);
|
|
$elNode->appendChild($simpleTypeNode);
|
|
|
|
|
+ // continue;// TODO: ? below added nillable = true, minOccurs = 0, type = $fldType
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
$fldType = 'xsd:string';
|
|
$fldType = 'xsd:string';
|
|
@@ -1184,6 +1175,8 @@ if($DBG){echo 'L.' . __LINE__ . ' sourceNsList:';print_r($sourceNsList);echo "\n
|
|
|
$elNode->setAttribute('nillable', 'true');
|
|
$elNode->setAttribute('nillable', 'true');
|
|
|
$elNode->setAttribute('minOccurs', '0');
|
|
$elNode->setAttribute('minOccurs', '0');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // only geometry fields
|
|
|
foreach ($fldList as $fldName) {
|
|
foreach ($fldList as $fldName) {
|
|
|
if (!$acl->isGeomField($fldName)) continue;
|
|
if (!$acl->isGeomField($fldName)) continue;
|
|
|
|
|
|
|
@@ -1230,6 +1223,8 @@ if($DBG){echo 'L.' . __LINE__ . ' sourceNsList:';print_r($sourceNsList);echo "\n
|
|
|
$elNode->setAttribute('nillable', 'true');
|
|
$elNode->setAttribute('nillable', 'true');
|
|
|
$elNode->setAttribute('minOccurs', '0');
|
|
$elNode->setAttribute('minOccurs', '0');
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
$attrNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:attribute');
|
|
$attrNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:attribute');
|
|
|
$updateTypeNode->appendChild($attrNode);
|
|
$updateTypeNode->appendChild($attrNode);
|