Assume, that explicit _null_ specification means the field is optional
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 14 Jan 2011 13:49:44 +0000 (13:49 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 14 Jan 2011 13:49:44 +0000 (13:49 +0000)
(_optional_ is not implemented in status so far), and reflect it in WS
interface.

org.glite.lb.server/src/ws_typeref.c.T
org.glite.lb.types/status.T
org.glite.lb.ws-interface/src/LBTypes.xml.T

index 71d62c4..069400c 100644 (file)
@@ -248,6 +248,14 @@ int edg_wll_StatusToSoap(struct soap *soap,edg_wll_JobStat const *src,struct lbt
                        gen "\tjs->$usuc->tvUsec = src->$_.tv_usec;\n";
                } elsif ($ft eq 'string') {
                        gen "\tjs->$usuc = soap_strdup(soap,src->$_);\n";
+               } elsif ($f->{null}) {
+                       gen qq{
+!      if (src->$_ == $f->{null}) js->$usuc = NULL;
+!      else {
+!              js->$usuc = soap_malloc(soap,sizeof *js->$usuc);
+!              *js->$usuc = src->$_;
+!      }
+};
                } else { gen "\tjs->$usuc = src->$_;\n"; }
        }
 @@@}
@@ -318,6 +326,8 @@ void edg_wll_SoapToStatus(struct soap *soap,struct lbt__jobStatus const *src,edg
                } elsif ($ft eq 'string') {
                        gen "\tdest->$_ = src->$usuc;\n";
                        gen "\tsoap_unlink(soap,src->$usuc);\n";
+               } elsif ($f->{null}) {
+                       gen "\tdest->$_ = (src->$usuc) ? *(src->$usuc) : $f->{null};\n";
                } else {
                        gen "\tdest->$_ = src->$usuc;\n";
 }
index 4e2b302..0ad9dd3 100644 (file)
@@ -163,6 +163,7 @@ int cream_exit_code         Job exit code
 bool   cream_cancelling        Cancellation request in process
 int    cream_cpu_time          Consumed CPU time
 int    cream_jw_status         Users jw_status enum
+       _null_ -1
 
 _pad_  30
 
index a932bad..610e123 100644 (file)
@@ -80,6 +80,7 @@
                }
 
                my $comment = getComment $f;
+# XXX: if null value is specified, the field can be optional
                if ($name eq 'stateEnterTimes' || $name eq 'childrenHist') {
 # XXX: stateEnterTimes and childrenHist are the only case of enum-indexed array
                        gen qq{
 };
                }
                else {
-# XXX: currently nothing is "optional" as we don't know from status.T 
+# orig XXX: currently nothing is "optional" as we don't know from status.T 
+# XXX: if null is defined, the field is optional
+                       my $opt = $f->{null} ? 'yes' : 'no';
                        gen qq{
-!                              <elem name="$name" type="$type" list="$list" optional="no">$comment</elem>
+!                              <elem name="$name" type="$type" list="$list" optional="$opt">$comment</elem>
 };
                }
        }