lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 8a99983 3/3: Expunge input element 'InforceDa


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 8a99983 3/3: Expunge input element 'InforceDataSource'
Date: Mon, 2 Jul 2018 10:51:05 -0400 (EDT)

branch: master
commit 8a99983478c167ca12c5e2bbf448d5b84e11e576
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Expunge input element 'InforceDataSource'
    
    The 'data_source' attribute serves the same function in a much better
    way, because it occurs at the top of every document rather than inside
    multiple subelements.
---
 cell.rnc                   |  2 --
 cell.xsd                   |  6 ------
 input.cpp                  |  2 --
 input.hpp                  |  1 -
 input_xml_io.cpp           |  1 +
 multiple_cell_document.cpp | 43 ++++++++++++++-----------------------------
 sample.cns                 |  3 ---
 sample.ill                 |  1 -
 single_cell_document.cpp   | 39 ++++++++++++++-------------------------
 yare_input.cpp             |  1 -
 yare_input.hpp             |  1 -
 11 files changed, 29 insertions(+), 71 deletions(-)

diff --git a/cell.rnc b/cell.rnc
index 31920e3..2a18441 100644
--- a/cell.rnc
+++ b/cell.rnc
@@ -214,8 +214,6 @@ cell_element = element cell
      element InforceCumulativeRopPayments     {nonnegative_double}
     ,## Inforce cumulative refundable sales load.
      element InforceCumulativeSalesLoad       {nonnegative_double}
-    ,## Vendor identifier for files from an external system.
-     element InforceDataSource                {xsd:nonNegativeInteger}
     ,## Inforce 7702A deemed cash value.
      element InforceDcv                       {nonnegative_double}
     ,## Inforce unloaned account value in the general account.
diff --git a/cell.xsd b/cell.xsd
index ba8327f..1a4ccc8 100644
--- a/cell.xsd
+++ b/cell.xsd
@@ -112,7 +112,6 @@
         <xs:element ref="InforceCumulativeNoLapsePremium"/>
         <xs:element ref="InforceCumulativeRopPayments"/>
         <xs:element ref="InforceCumulativeSalesLoad"/>
-        <xs:element ref="InforceDataSource"/>
         <xs:element ref="InforceDcv"/>
         <xs:element ref="InforceGeneralAccountValue"/>
         <xs:element ref="InforceGlp"/>
@@ -649,11 +648,6 @@ or forced out.</xs:documentation>
       <xs:documentation>Inforce cumulative refundable sales 
load.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="InforceDataSource" type="xs:nonNegativeInteger">
-    <xs:annotation>
-      <xs:documentation>Vendor identifier for files from an external 
system.</xs:documentation>
-    </xs:annotation>
-  </xs:element>
   <xs:element name="InforceDcv" type="nonnegative_double">
     <xs:annotation>
       <xs:documentation>Inforce 7702A deemed cash value.</xs:documentation>
diff --git a/input.cpp b/input.cpp
index 90faf70..1486e65 100644
--- a/input.cpp
+++ b/input.cpp
@@ -122,7 +122,6 @@ Input::Input()
     ,IncludeInComposite               ("Yes")
 //    ,Comments                         ("")
 //    ,AmortizePremiumLoad              ("")
-    ,InforceDataSource                ("1") // 0=error; 1=lmi; 2+=other
 //    ,ContractNumber                   ("")
 //    ,MasterContractNumber             ("")
 //    ,InforceAsOfDate                  ("")
@@ -369,7 +368,6 @@ void Input::AscribeMembers()
     ascribe("IncludeInComposite"              , &Input::IncludeInComposite     
         );
     ascribe("Comments"                        , &Input::Comments               
         );
     ascribe("AmortizePremiumLoad"             , &Input::AmortizePremiumLoad    
         );
-    ascribe("InforceDataSource"               , &Input::InforceDataSource      
         );
     ascribe("ContractNumber"                  , &Input::ContractNumber         
         );
     ascribe("MasterContractNumber"            , &Input::MasterContractNumber   
         );
     ascribe("InforceAsOfDate"                 , &Input::InforceAsOfDate        
         );
diff --git a/input.hpp b/input.hpp
index 3eece12..0d4de6d 100644
--- a/input.hpp
+++ b/input.hpp
@@ -319,7 +319,6 @@ class LMI_SO Input final
     mce_yes_or_no            IncludeInComposite              ;
     datum_string             Comments                        ;
     mce_yes_or_no            AmortizePremiumLoad             ;
-    tnr_nonnegative_integer  InforceDataSource               ;
     datum_string             ContractNumber                  ;
     datum_string             MasterContractNumber            ;
     tnr_date                 InforceAsOfDate                 ;
diff --git a/input_xml_io.cpp b/input_xml_io.cpp
index 3ff472d..42050cf 100644
--- a/input_xml_io.cpp
+++ b/input_xml_io.cpp
@@ -127,6 +127,7 @@ bool Input::is_detritus(std::string const& s) const
         ,"IndividualPaymentToAlternative"   // Withdrawn.
         ,"IndividualPaymentToDuration"      // Withdrawn.
         ,"InforceCumulativePayments"        // Renamed to 
'InforceCumulativeNoLapsePayments'.
+        ,"InforceDataSource"                // Supplanted by 'data_source' 
attribute.
         ,"InforceDcvDeathBenefit"           // Misbegotten.
         ,"InforceExperienceReserve"         // Renamed before implementation.
         ,"InsuredPremiumTableNumber"        // Never implemented.
diff --git a/multiple_cell_document.cpp b/multiple_cell_document.cpp
index b561134..69aa068 100644
--- a/multiple_cell_document.cpp
+++ b/multiple_cell_document.cpp
@@ -385,45 +385,30 @@ void multiple_cell_document::parse_v0(xml_lmi::dom_parser 
const& parser)
 /// which imposes an overhead of about twenty percent, is skipped for
 /// files produced by lmi itself, which are presumptively valid.
 ///
-/// Regrettably, as this is written in 2013-04, external files
-/// represent the data source in <cell> element <InforceDataSource>
-/// rather than in root attribute "data_source", so for now it is
-/// necessary to look for the lower-level element. Both represent the
-/// data source the same way: "0" is reserved, "1" means lmi, and
-/// each external system is assigned a higher integer.
+/// Values for root attribute "data_source":
+///   "0" is reserved;
+///   "1" means lmi; and
+///   each external system is assigned a higher integer.
+///
+/// If the "data_source" attribute is not present, then presume that
+/// the source is external iff a "file_version" attribute is present
+/// and a schema for that version exists.
 
 bool multiple_cell_document::data_source_is_external(xml::document const& d) 
const
 {
     xml::element const& root(d.get_root_node());
-
     int data_source = 0;
     if(xml_lmi::get_attr(root, "data_source", data_source))
         {
-        return 1 < data_source;
+        LMI_ASSERT(0 != data_source);
+        return 1 != data_source;
         }
-
-    // INPUT !! Remove "InforceDataSource" and the following code when
-    // external systems are updated to use the "data_source" attribute.
-
-    // Tag names vary: {"case_default", "class_defaults", "particular_cells"}.
-    xml::const_nodes_view const i_nodes(root.elements());
-    LMI_ASSERT(3 == i_nodes.size());
-    for(auto const& i : i_nodes)
+    else
         {
-        for(auto const& j : i.elements("cell"))
-            {
-            for(auto const& k : j.elements("InforceDataSource"))
-                {
-                std::string s(xml_lmi::get_content(k));
-                if("0" != s && "1" != s)
-                    {
-                    return true;
-                    }
-                }
-            }
+        int file_version = 0;
+        xml_lmi::get_attr(root, "version", file_version);
+        return 7 <= file_version;
         }
-
-    return false;
 }
 
 /// Coarsely validate file format with XSD schema.
diff --git a/sample.cns b/sample.cns
index 4fd2320..bebdc59 100644
--- a/sample.cns
+++ b/sample.cns
@@ -75,7 +75,6 @@
       <InforceCumulativeNoLapsePremium>0</InforceCumulativeNoLapsePremium>
       <InforceCumulativeRopPayments>0</InforceCumulativeRopPayments>
       <InforceCumulativeSalesLoad>0</InforceCumulativeSalesLoad>
-      <InforceDataSource>1</InforceDataSource>
       <InforceDcv>0</InforceDcv>
       <InforceGeneralAccountValue>0</InforceGeneralAccountValue>
       <InforceGlp>0</InforceGlp>
@@ -274,7 +273,6 @@
       <InforceCumulativeNoLapsePremium>0</InforceCumulativeNoLapsePremium>
       <InforceCumulativeRopPayments>0</InforceCumulativeRopPayments>
       <InforceCumulativeSalesLoad>0</InforceCumulativeSalesLoad>
-      <InforceDataSource>1</InforceDataSource>
       <InforceDcv>0</InforceDcv>
       <InforceGeneralAccountValue>0</InforceGeneralAccountValue>
       <InforceGlp>0</InforceGlp>
@@ -473,7 +471,6 @@
       <InforceCumulativeNoLapsePremium>0</InforceCumulativeNoLapsePremium>
       <InforceCumulativeRopPayments>0</InforceCumulativeRopPayments>
       <InforceCumulativeSalesLoad>0</InforceCumulativeSalesLoad>
-      <InforceDataSource>1</InforceDataSource>
       <InforceDcv>0</InforceDcv>
       <InforceGeneralAccountValue>0</InforceGeneralAccountValue>
       <InforceGlp>0</InforceGlp>
diff --git a/sample.ill b/sample.ill
index e62e495..4012b5a 100644
--- a/sample.ill
+++ b/sample.ill
@@ -74,7 +74,6 @@
     <InforceCumulativeNoLapsePremium>0</InforceCumulativeNoLapsePremium>
     <InforceCumulativeRopPayments>0</InforceCumulativeRopPayments>
     <InforceCumulativeSalesLoad>0</InforceCumulativeSalesLoad>
-    <InforceDataSource>1</InforceDataSource>
     <InforceDcv>0</InforceDcv>
     <InforceGeneralAccountValue>0</InforceGeneralAccountValue>
     <InforceGlp>0</InforceGlp>
diff --git a/single_cell_document.cpp b/single_cell_document.cpp
index dba910a..03ac44c 100644
--- a/single_cell_document.cpp
+++ b/single_cell_document.cpp
@@ -126,41 +126,30 @@ void single_cell_document::parse(xml_lmi::dom_parser 
const& parser)
 /// which imposes an overhead of about twenty percent, is skipped for
 /// files produced by lmi itself, which are presumptively valid.
 ///
-/// Regrettably, as this is written in 2013-04, external files
-/// represent the data source in <cell> element <InforceDataSource>
-/// rather than in root attribute "data_source", so for now it is
-/// necessary to look for the lower-level element. Both represent the
-/// data source the same way: "0" is reserved, "1" means lmi, and
-/// each external system is assigned a higher integer.
+/// Values for root attribute "data_source":
+///   "0" is reserved;
+///   "1" means lmi; and
+///   each external system is assigned a higher integer.
+///
+/// If the "data_source" attribute is not present, then presume that
+/// the source is external iff a "file_version" attribute is present
+/// and a schema for that version exists.
 
 bool single_cell_document::data_source_is_external(xml::document const& d) 
const
 {
     xml::element const& root(d.get_root_node());
-
     int data_source = 0;
     if(xml_lmi::get_attr(root, "data_source", data_source))
         {
-        return 1 < data_source;
+        LMI_ASSERT(0 != data_source);
+        return 1 != data_source;
         }
-
-    // INPUT !! Remove "InforceDataSource" and the following code when
-    // external systems are updated to use the "data_source" attribute.
-
-    xml::const_nodes_view const i_nodes(root.elements("cell"));
-    LMI_ASSERT(1 == i_nodes.size());
-    for(auto const& i : i_nodes)
+    else
         {
-        for(auto const& j : i.elements("InforceDataSource"))
-            {
-            std::string s(xml_lmi::get_content(j));
-            if("0" != s && "1" != s)
-                {
-                return true;
-                }
-            }
+        int file_version = 0;
+        xml_lmi::get_attr(root, "version", file_version);
+        return 7 <= file_version;
         }
-
-    return false;
 }
 
 /// Coarsely validate file format with XSD schema.
diff --git a/yare_input.cpp b/yare_input.cpp
index 10c394f..5d51aa3 100644
--- a/yare_input.cpp
+++ b/yare_input.cpp
@@ -104,7 +104,6 @@ yare_input::yare_input(Input const& z)
     IncludeInComposite               = z.IncludeInComposite              
.value();
     Comments                         = z.Comments                        
.value();
     AmortizePremiumLoad              = z.AmortizePremiumLoad             
.value();
-    InforceDataSource                = z.InforceDataSource               
.value();
     ContractNumber                   = z.ContractNumber                  
.value();
     MasterContractNumber             = z.MasterContractNumber            
.value();
     InforceAsOfDate                  = z.InforceAsOfDate                 
.value();
diff --git a/yare_input.hpp b/yare_input.hpp
index 2a8dea7..ccef68a 100644
--- a/yare_input.hpp
+++ b/yare_input.hpp
@@ -145,7 +145,6 @@ class yare_input final
     bool                              IncludeInComposite              ;
     std::string                       Comments                        ;
     bool                              AmortizePremiumLoad             ;
-    int                               InforceDataSource               ;
     std::string                       ContractNumber                  ;
     std::string                       MasterContractNumber            ;
     calendar_date                     InforceAsOfDate                 ;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]