瀏覽代碼

HPCC-9935 Add SourceFormat to ESP FileSpray/SprayFixed request

In new ECLWatch UI, the SprayFixed Input page may add a Source
Format selection which contains: fixed, recfmv, recfmvb, and
variable. The FileSpray/SprayFixed should read the selection and
forward the selection to DFU workunit.

Signed-off-by: Kevin Wang <kevin.wang@lexisnexis.com>
Kevin Wang 11 年之前
父節點
當前提交
1f5a3175ea
共有 2 個文件被更改,包括 17 次插入12 次删除
  1. 1 0
      esp/scm/ws_fs.ecm
  2. 16 12
      esp/services/ws_fs/ws_fsService.cpp

+ 1 - 0
esp/scm/ws_fs.ecm

@@ -279,6 +279,7 @@ ESPrequest [nil_remove] SprayFixed
     string sourceIP;
     string sourcePath;
     binary srcxml;
+    string sourceFormat;
     int sourceRecordSize;
 
     string destGroup;

+ 16 - 12
esp/services/ws_fs/ws_fsService.cpp

@@ -1832,12 +1832,6 @@ bool CFileSprayEx::onSprayFixed(IEspContext &context, IEspSprayFixed &req, IEspS
                 throw MakeStringException(ECLWATCH_INVALID_INPUT, "Source file not specified.");
         }
 
-        bool nosplit = req.getNosplit();
-        int recordsize = req.getSourceRecordSize();
-        if(recordsize == 0 && !nosplit)             // -ve record sizes for blocked
-            throw MakeStringException(ECLWATCH_INVALID_INPUT, "Invalid record size"); 
-
-
         const char* destname = req.getDestLogicalName();
         if(!destname || !*destname)
             throw MakeStringException(ECLWATCH_INVALID_INPUT, "Destination file not specified.");
@@ -1891,24 +1885,34 @@ bool CFileSprayEx::onSprayFixed(IEspContext &context, IEspSprayFixed &req, IEspS
         }
 
         IDFUfileSpec *destination = wu->queryUpdateDestination();
-        if(recordsize > 0)
-            source->setRecordSize(recordsize);
-        else if (recordsize == RECFMVB_RECSIZE_ESCAPE) {
+        bool nosplit = req.getNosplit();
+        int recordsize = req.getSourceRecordSize();
+        const char* format = req.getSourceFormat();
+        if ((recordsize == RECFMVB_RECSIZE_ESCAPE) || (format && strieq(format, "recfmvb")))
+        {//recordsize may be set by dfuplus; format may be set by EclWatch
             source->setFormat(DFUff_recfmvb);
             destination->setFormat(DFUff_variable);
         }
-        else if (recordsize == RECFMV_RECSIZE_ESCAPE) {
+        else if ((recordsize == RECFMV_RECSIZE_ESCAPE) || (format && strieq(format, "recfmv")))
+        {
             source->setFormat(DFUff_recfmv);
             destination->setFormat(DFUff_variable);
         }
-        else if (recordsize == PREFIX_VARIABLE_RECSIZE_ESCAPE) {
+        else if ((recordsize == PREFIX_VARIABLE_RECSIZE_ESCAPE) || (format && strieq(format, "variable")))
+        {
             source->setFormat(DFUff_variable);
             destination->setFormat(DFUff_variable);
         }
-        else if (recordsize == PREFIX_VARIABLE_BIGENDIAN_RECSIZE_ESCAPE) {
+        else if((recordsize == PREFIX_VARIABLE_BIGENDIAN_RECSIZE_ESCAPE) || (format && strieq(format, "variablebigendian")))
+        {
             source->setFormat(DFUff_variablebigendian);
             destination->setFormat(DFUff_variable);
         }
+        else if(recordsize == 0 && !nosplit)             // -ve record sizes for blocked
+            throw MakeStringException(ECLWATCH_INVALID_INPUT, "Invalid record size");
+        else
+            source->setRecordSize(recordsize);
+
         destination->setLogicalName(destname);
         destination->setDirectory(destFolder.str());