Browse Source

HPCC-17632 Add process "required" entry in AppInfo

xwang2713 8 years ago
parent
commit
82eeff61fa

+ 7 - 1
configuration/configurator/schemas/SchemaAppInfo.cpp

@@ -56,6 +56,8 @@ CAppInfo* CAppInfo::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchema
     strXPathDocID.append("/").append(TAG_DOC_ID);
     StringBuffer strXPathDocLineBreak(xpath);
     strXPathDocLineBreak.append("/").append(TAG_DOC_USE_LINE_BREAK);
+    StringBuffer strXPathRequired(xpath);
+    strXPathRequired.append("/").append(TAG_REQUIRED);
 
     StringBuffer strViewType;
     StringBuffer strColIndex;
@@ -68,6 +70,7 @@ CAppInfo* CAppInfo::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchema
     StringBuffer strViewChildNodes;
     StringBuffer strXPath;
     StringBuffer strDocTableID;
+    StringBuffer strRequired;
     bool bDocLineBreak = false;
 
     if (pSchemaRoot->queryPropTree(strXPathViewType.str()) != NULL)
@@ -94,8 +97,10 @@ CAppInfo* CAppInfo::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchema
         strDocTableID.append(pSchemaRoot->queryPropTree(strXPathDocID.str())->queryProp(""));
     if (pSchemaRoot->queryPropTree(strXPathDocLineBreak.str()) != NULL)
         bDocLineBreak = true;
+    if (pSchemaRoot->queryPropTree(strXPathRequired.str()) != NULL)
+        strRequired.append(pSchemaRoot->queryPropTree(strXPathRequired.str())->queryProp(""));
 
-    CAppInfo *pAppInfo = new CAppInfo(pParentNode, strViewType.str(),  strColIndex.str(), strToolTip.str(), strTitle.str(), strWidth.str(), strAutoGenForWizard.str(), strAutoGenDefaultValue.str(), NULL, strViewChildNodes.str(), strXPath.str(), strDocTableID.str(), bDocLineBreak);
+    CAppInfo *pAppInfo = new CAppInfo(pParentNode, strViewType.str(),  strColIndex.str(), strToolTip.str(), strTitle.str(), strWidth.str(), strAutoGenForWizard.str(), strAutoGenDefaultValue.str(), NULL, strViewChildNodes.str(), strXPath.str(), strDocTableID.str(), bDocLineBreak, strRequired.str());
     pAppInfo->setXSDXPath(xpath);
 
     return pAppInfo;
@@ -118,6 +123,7 @@ void CAppInfo::dump(::std::ostream &cout, unsigned int offset) const
     QUICK_OUT(cout, ViewChildNodes, offset);
     QUICK_OUT(cout, XPath, offset);
     QUICK_OUT(cout, XSDXPath, offset);
+    QUICK_OUT(cout, Required, offset);
 
     quickOutFooter(cout, XSD_APP_INFO_STR, offset);
 }

+ 5 - 3
configuration/configurator/schemas/SchemaAppInfo.hpp

@@ -44,6 +44,7 @@ public:
     GETTERSETTER(ViewChildNodes)
     GETTERSETTER(XPath)
     GETTERSETTER(DocTableID)
+    GETTERSETTER(Required)
 
     virtual void dump(::std::ostream &cout, unsigned int offset = 0) const;
     virtual void getDocumentation(StringBuffer &strDoc) const;
@@ -58,10 +59,11 @@ public:
 protected:
 
     CAppInfo(CXSDNodeBase* pParentNode, const char *pViewType = NULL, const char *pColIndex = NULL, const char* pToolTip = NULL, const char* pTitle = NULL, const char* pWidth = NULL, const char* pAutoGenForWizard = NULL,\
-             const char* pAutoGenDefaultValue = NULL, const char* pAutoGenDefaultForMultiNode = NULL, const char* pViewChildNodes = NULL, const char* pXPath = NULL, const char* pDocTableID = NULL, bool bDocLineBreak = false)\
+             const char* pAutoGenDefaultValue = NULL, const char* pAutoGenDefaultForMultiNode = NULL, const char* pViewChildNodes = NULL, const char* pXPath = NULL, const char* pDocTableID = NULL, bool bDocLineBreak = false, \
+			 const char* pRequired = NULL ) \
         : CXSDNodeBase::CXSDNodeBase(pParentNode, XSD_APP_INFO), m_strViewType(pViewType), m_strColIndex(pColIndex), m_strToolTip(pToolTip), m_strTitle(pTitle), m_strWidth(pWidth), m_strAutoGenForWizard(pAutoGenForWizard),\
-          m_strAutoGenDefaultValue(pAutoGenDefaultValue), m_strAutoGenDefaultValueForMultiNode(pAutoGenDefaultForMultiNode), m_strViewChildNodes(pViewChildNodes), m_strXPath(pXPath), m_strDocTableID(pDocTableID),\
-          m_bDocLineBreak(bDocLineBreak)
+          m_strAutoGenDefaultValue(pAutoGenDefaultValue), m_strAutoGenDefaultValueForMultiNode(pAutoGenDefaultForMultiNode), m_strViewChildNodes(pViewChildNodes), m_strXPath(pXPath), m_strDocTableID(pDocTableID), \
+          m_bDocLineBreak(bDocLineBreak), m_strRequired(pRequired)
     {
     }
 

+ 4 - 0
configuration/configurator/schemas/SchemaAttributes.cpp

@@ -105,6 +105,10 @@ void CAttribute::getDocumentation(StringBuffer &strDoc) const
             return; // HIDDEN
         else
             pToolTip = pAppInfo->getToolTip();
+
+        const char* pReq = pAppInfo->getRequired();
+        if (pReq != nullptr && stricmp("True", pReq) == 0)
+            pRequired = TAG_REQUIRED;
     }
 
     strDoc.appendf("<%s>\n", DM_TABLE_ROW);

+ 1 - 0
configuration/configurator/schemas/SchemaCommon.hpp

@@ -248,6 +248,7 @@ static const char* TAG_AUTOGENDEFAULTVALUEFORMULTINODE("autogendefaultformultino
 static const char* TAG_XPATH("xpath");
 static const char* TAG_DOC_ID("docid");
 static const char* TAG_DOC_USE_LINE_BREAK("docuselinebreak");
+static const char* TAG_REQUIRED("required");
 static const char* TAG_UNBOUNDED("unbounded");
 
 #define TAG_OPTIONAL                   "optional"