From 17a56975b521c27149bf70db991f18c8c6acf288 Mon Sep 17 00:00:00 2001
From: Benjamin Renard <benjamin.renard@akka.eu>
Date: Fri, 12 Jan 2024 13:32:13 +0000
Subject: [PATCH] Get Modification dates

---
 src/DDSERVICES/SOAP/DDserverWeb.php | 43 +++++++++++++++++++++++++++++++++++++++++++
 src/DDSERVICES/SOAP/dd.wsdl.in      | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/src/DDSERVICES/SOAP/DDserverWeb.php b/src/DDSERVICES/SOAP/DDserverWeb.php
index bf6fbda..df5a775 100644
--- a/src/DDSERVICES/SOAP/DDserverWeb.php
+++ b/src/DDSERVICES/SOAP/DDserverWeb.php
@@ -101,6 +101,49 @@
             return $result;
          }
 
+         
+/**
+*  Returns list of datasets with TimeRestriction
+*/
+function getDatasetsModificationDates()
+{
+   $result = array(
+   );
+   $referXML = baseDir."/DDsys.xml";
+   $DDsys = new DOMDocument("1.0");
+   @$DDsys->load($referXML);
+   $xp = new domxpath($DDsys);
+   $VINodes = $xp->query("//VI");
+   if ($VINodes->length == 0) {
+       return $result;
+   }
+
+   foreach ($VINodes as $VINode)
+   {
+       $locationNode = $VINode->getElementsByTagName("LOCATION");
+       $nameNode = $VINode->getElementsByTagName("NAME");
+       $timesNode = $VINode->getElementsByTagName("TIMES");
+       if (($locationNode->length > 0) && ($nameNode->length > 0) && ($timesNode->length > 0))
+       {
+           $locationNode = $locationNode->item(0);
+           $nameNode = $nameNode->item(0);
+           $location = $locationNode->nodeValue;
+           $viName = $nameNode->nodeValue;
+           $timesNode = $timesNode->item(0);
+           $timesFile = $location.$timesNode->nodeValue;
+           if (!empty($location) && !empty($viName)) {
+              $result[] = array(
+                'vi' => $viName,
+                'releaseDate' => "2008-01-01T00:00:00.000Z",
+                'modificationDate' => "2018-01-01T00:00:00.000Z",
+              );
+            }
+        } 
+   }
+
+   return $result;
+}
+
 /**     
 *  Returns restricted TimeRestriction and GlobalStop in case of time restriction
 */
diff --git a/src/DDSERVICES/SOAP/dd.wsdl.in b/src/DDSERVICES/SOAP/dd.wsdl.in
index 483a5c1..a1d9901 100644
--- a/src/DDSERVICES/SOAP/dd.wsdl.in
+++ b/src/DDSERVICES/SOAP/dd.wsdl.in
@@ -47,6 +47,19 @@
       </tns:element>
     </tns:sequence> 
   </tns:complexType>
+  <tns:complexType name="ListOfDatasetModificationDate">
+    <tns:sequence>
+      <tns:element minOccurs="0" maxOccurs="unbounded" name="DatasetModificationDate">
+        <tns:complexType>
+          <tns:sequence>
+            <tns:element minOccurs="1" maxOccurs="1" name="vi" type="xsd:string"/>
+            <tns:element minOccurs="1" maxOccurs="1" name="releaseDate" type="xsd:string"/>
+            <tns:element minOccurs="1" maxOccurs="1" name="modificationDate" type="xsd:string"/>
+          </tns:sequence>
+        </tns:complexType>
+      </tns:element>
+    </tns:sequence> 
+  </tns:complexType>
 </types>
 
 <message name='isRemoteViAddedRequest'>
@@ -174,6 +187,11 @@
 <message name='getDatasetsWithTimeRestrictionResponse'>
  <part name='Result' type='tns:ListOfDatasetTimeRestrictionData'/>
 </message>
+<message name='getDatasetsModficationDatesRequest'>
+</message>
+<message name='getDatasetsModficationDatesResponse'>
+ <part name='Result' type='tns:ListOfDatasetModificationDate'/>
+</message>
 
 <portType name='AmdaPortType'>
     <operation name='isRemoteViAdded'>
@@ -256,6 +274,12 @@
     <input message='tns:getDatasetsWithTimeRestrictionRequest'/>
     <output message='tns:getDatasetsWithTimeRestrictionResponse'/>
   </operation>
+  <operation name='getDatasetsModficationDates'>
+    <input message='tns:getDatasetsModficationDatesRequest'/>
+    <output message='tns:getDatasetsModficationDatesResponse'/>
+  </operation>
+  
+
 </portType>
 
 <binding name='AmdaBinding' type='tns:AmdaPortType'>
@@ -481,6 +505,17 @@
         encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
     </output>
   </operation>
+  <operation name='getDatasetsModificationDates'>
+    <soap:operation soapAction='getDatasetsModificationDates'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
 </binding>
 
 <service name='AmdaService'>
--
libgit2 0.21.2