SchemaAppInfo.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #include "jptree.hpp"
  14. #include "XMLTags.h"
  15. #include "SchemaAppInfo.hpp"
  16. #include "DocumentationMarkup.hpp"
  17. using namespace CONFIGURATOR;
  18. #define IPropertyTree ::IPropertyTree
  19. CAppInfo* CAppInfo::load(CXSDNodeBase* pParentNode, const IPropertyTree *pSchemaRoot, const char* xpath)
  20. {
  21. if (pSchemaRoot == NULL)
  22. return NULL;
  23. if (pSchemaRoot->queryPropTree(xpath) == NULL)
  24. return NULL; // No AppInfo node
  25. StringBuffer strXPathViewType(xpath);
  26. strXPathViewType.append("/").append(TAG_VIEWTYPE);
  27. StringBuffer strXPathColIndex(xpath);
  28. strXPathColIndex.append("/").append(TAG_COLINDEX);
  29. StringBuffer strXPathToolTip(xpath);
  30. strXPathToolTip.append("/").append(TAG_TOOLTIP);
  31. StringBuffer strXPathTitle(xpath);
  32. strXPathTitle.append("/").append(TAG_TITLE);
  33. StringBuffer strXPathWidth(xpath);
  34. strXPathWidth.append("/").append(TAG_WIDTH);
  35. StringBuffer strXPathAutoGenDefaultValue(xpath);
  36. strXPathAutoGenDefaultValue.append("/").append(TAG_AUTOGENWIZARD);
  37. StringBuffer strXPathAutoGenForWizard(xpath);
  38. strXPathAutoGenForWizard.append("/").append(TAG_AUTOGENDEFAULTVALUE);
  39. StringBuffer strXPathAutoGenDefaultForMultiNode(xpath);
  40. strXPathAutoGenDefaultForMultiNode.append("/").append(TAG_AUTOGENDEFAULTVALUEFORMULTINODE);
  41. StringBuffer strXPathViewChildNodes(xpath);
  42. strXPathViewChildNodes.append("/").append(TAG_VIEWCHILDNODES);
  43. StringBuffer strXPathXPath(xpath);
  44. strXPathXPath.append("/").append(TAG_XPATH);
  45. StringBuffer strXPathDocID(xpath);
  46. strXPathDocID.append("/").append(TAG_DOC_ID);
  47. StringBuffer strXPathDocLineBreak(xpath);
  48. strXPathDocLineBreak.append("/").append(TAG_DOC_USE_LINE_BREAK);
  49. StringBuffer strXPathRequired(xpath);
  50. strXPathRequired.append("/").append(TAG_REQUIRED);
  51. StringBuffer strViewType;
  52. StringBuffer strColIndex;
  53. StringBuffer strToolTip;
  54. StringBuffer strTitle;
  55. StringBuffer strWidth;
  56. StringBuffer strAutoGenForWizard;
  57. StringBuffer strAutoGenDefaultValue;
  58. StringBuffer strAutoGenDefaultForMultiNode;
  59. StringBuffer strViewChildNodes;
  60. StringBuffer strXPath;
  61. StringBuffer strDocTableID;
  62. StringBuffer strRequired;
  63. bool bDocLineBreak = false;
  64. if (pSchemaRoot->queryPropTree(strXPathViewType.str()) != NULL)
  65. strViewType.append(pSchemaRoot->queryPropTree(strXPathViewType.str())->queryProp(""));
  66. if (pSchemaRoot->queryPropTree(strXPathColIndex.str()) != NULL)
  67. strColIndex.append(pSchemaRoot->queryPropTree(strXPathColIndex.str())->queryProp(""));
  68. if (pSchemaRoot->queryPropTree(strXPathToolTip.str()) != NULL)
  69. strToolTip.append(pSchemaRoot->queryPropTree(strXPathToolTip.str())->queryProp(""));
  70. if (pSchemaRoot->queryPropTree(strXPathTitle.str()) != NULL)
  71. strTitle.append(pSchemaRoot->queryPropTree(strXPathTitle.str())->queryProp(""));
  72. if (pSchemaRoot->queryPropTree(strXPathWidth.str()) != NULL)
  73. strWidth.append(pSchemaRoot->queryPropTree(strXPathWidth.str())->queryProp(""));
  74. if (pSchemaRoot->queryPropTree(strXPathAutoGenForWizard.str()) != NULL)
  75. strAutoGenForWizard.append(pSchemaRoot->queryPropTree(strXPathAutoGenForWizard.str())->queryProp(""));
  76. if (pSchemaRoot->queryPropTree(strXPathAutoGenDefaultValue.str()) != NULL)
  77. strAutoGenDefaultValue.append(pSchemaRoot->queryPropTree(strXPathAutoGenDefaultValue.str())->queryProp(""));
  78. if (pSchemaRoot->queryPropTree(strXPathAutoGenDefaultForMultiNode.str()) != NULL)
  79. strAutoGenDefaultForMultiNode.append(pSchemaRoot->queryPropTree(strXPathAutoGenDefaultForMultiNode.str())->queryProp(""));
  80. if (pSchemaRoot->queryPropTree(strXPathViewChildNodes.str()) != NULL)
  81. strViewChildNodes.append(pSchemaRoot->queryPropTree(strXPathViewChildNodes.str())->queryProp(""));
  82. if (pSchemaRoot->queryPropTree(strXPathXPath.str()) != NULL)
  83. strXPath.append(pSchemaRoot->queryPropTree(strXPathXPath.str())->queryProp(""));
  84. if (pSchemaRoot->queryPropTree(strXPathDocID.str()) != NULL)
  85. strDocTableID.append(pSchemaRoot->queryPropTree(strXPathDocID.str())->queryProp(""));
  86. if (pSchemaRoot->queryPropTree(strXPathDocLineBreak.str()) != NULL)
  87. bDocLineBreak = true;
  88. if (pSchemaRoot->queryPropTree(strXPathRequired.str()) != NULL)
  89. strRequired.append(pSchemaRoot->queryPropTree(strXPathRequired.str())->queryProp(""));
  90. 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());
  91. pAppInfo->setXSDXPath(xpath);
  92. return pAppInfo;
  93. }
  94. void CAppInfo::dump(::std::ostream &cout, unsigned int offset) const
  95. {
  96. offset += STANDARD_OFFSET_1;
  97. quickOutHeader(cout, XSD_APP_INFO_STR, offset);
  98. QUICK_OUT(cout, Title, offset);
  99. QUICK_OUT(cout, ViewType, offset);
  100. QUICK_OUT(cout, ToolTip, offset);
  101. QUICK_OUT(cout, ColIndex, offset);
  102. QUICK_OUT(cout, Width, offset);
  103. QUICK_OUT(cout, AutoGenForWizard, offset);
  104. QUICK_OUT(cout, AutoGenDefaultValue, offset);
  105. QUICK_OUT(cout, AutoGenDefaultValueForMultiNode, offset);
  106. QUICK_OUT(cout, ViewChildNodes, offset);
  107. QUICK_OUT(cout, XPath, offset);
  108. QUICK_OUT(cout, XSDXPath, offset);
  109. QUICK_OUT(cout, Required, offset);
  110. quickOutFooter(cout, XSD_APP_INFO_STR, offset);
  111. }
  112. void CAppInfo::getDocumentation(StringBuffer &strDoc) const
  113. {
  114. }
  115. void CAppInfo::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
  116. {
  117. }