Skip to content
Snippets Groups Projects
Commit 741e4231 authored by Bensong Liu's avatar Bensong Liu
Browse files

revert previous change: removed explicit argument spec

parent 7fd539d6
No related branches found
No related tags found
1 merge request!1Allow explicit arg
...@@ -34,16 +34,13 @@ namespace CIS { ...@@ -34,16 +34,13 @@ namespace CIS {
inputSettings[k] = v; inputSettings[k] = v;
} }
void explicitSetRawArgument(string argTypeInXaml, string argValueInCSharp) { void explicitSetRawArgument(string argTypeInXaml, string argValueInCSharp) {
explicitArgType = argTypeInXaml; throw std::runtime_error("NotSupported! Activity seems doesn't support custom type inputSettings at all. Refer to commit 7fd539d6d5f6b102337da9591217b781cb71ced9 if we get new info and want to support it again. ");
explicitArgValue = argValueInCSharp;
} }
private: private:
string displayName, className, entityName; string displayName, className, entityName;
string taskId; string taskId;
std::unordered_map<string, string> inputSettings; std::unordered_map<string, string> inputSettings;
string explicitArgType, explicitArgValue;
auto inputSettingsToCodelines() const { auto inputSettingsToCodelines() const {
// Convert InputSettings Dictionary to C# code. // Convert InputSettings Dictionary to C# code.
std::list<string> inputSettingStrings; std::list<string> inputSettingStrings;
...@@ -54,29 +51,19 @@ namespace CIS { ...@@ -54,29 +51,19 @@ namespace CIS {
return rlib::string(templates::ACTIVITY_DICT_TEMPLATE_UNESCAPED).replace_once("__TEMPLATE_ARG_DictLines", inputSettingsString); return rlib::string(templates::ACTIVITY_DICT_TEMPLATE_UNESCAPED).replace_once("__TEMPLATE_ARG_DictLines", inputSettingsString);
} }
auto generateXaml() const { auto generateXaml() const {
rlib::string xamlCode = templates::ACTIVITY_XAML_TEMPLATE; rlib::string xamlCode;
string argType, argValue; if(inputSettings.empty()) {
if(explicitArgType.empty() && explicitArgValue.empty()) { // Also no inputSettings.
// no explicit argument specified. xamlCode = templates::ACTIVITY_XAML_TEMPLATE_WITHOUT_INPUTSETTINGS;
if(inputSettings.empty()) {
// Also no inputSettings.
xamlCode = templates::ACTIVITY_XAML_TEMPLATE_WITHOUT_INPUTSETTINGS;
}
else {
// Generate inputSettings.
argType = templates::ACTIVITY_DICT_TYPENAME;
argValue = inputSettingsToCodelines();
}
} }
else { else {
// Use explicit argument. // Generate inputSettings.
argType = explicitArgType; xamlCode = templates::ACTIVITY_XAML_TEMPLATE;
argValue = explicitArgValue; xamlCode.replace("__TEMPLATE_ARG_TypeName", templates::ACTIVITY_DICT_TYPENAME);
xamlCode.replace_once("__TEMPLATE_ARG_TypeValue", Utility::HtmlEscapeString(inputSettingsToCodelines()));
} }
xamlCode.replace("__TEMPLATE_ARG_TypeName", argType);
xamlCode.replace_once("__TEMPLATE_ARG_TypeValue", Utility::HtmlEscapeString(argValue));
xamlCode.replace_once("__TEMPLATE_ARG_ClassName", this->className); xamlCode.replace_once("__TEMPLATE_ARG_ClassName", this->className);
xamlCode.replace_once("__TEMPLATE_ARG_DisplayName", this->displayName); xamlCode.replace_once("__TEMPLATE_ARG_DisplayName", this->displayName);
xamlCode.replace_once("__TEMPLATE_ARG_TaskId", this->taskId); xamlCode.replace_once("__TEMPLATE_ARG_TaskId", this->taskId);
......
...@@ -24,6 +24,7 @@ R"XAMLTL( <mwcwa:ControlledActivity ClassName="__TEMPLATE_ARG_ClassName" Disp ...@@ -24,6 +24,7 @@ R"XAMLTL( <mwcwa:ControlledActivity ClassName="__TEMPLATE_ARG_ClassName" Disp
</mwcwa:ControlledActivity> </mwcwa:ControlledActivity>
)XAMLTL"; )XAMLTL";
// This 2 variable below were designed to support custom TypeArguments type, but CIS seems not support it...
constexpr auto ACTIVITY_DICT_TYPENAME = "scg:Dictionary(x:String, x:String)"; constexpr auto ACTIVITY_DICT_TYPENAME = "scg:Dictionary(x:String, x:String)";
constexpr auto ACTIVITY_DICT_TEMPLATE_UNESCAPED = constexpr auto ACTIVITY_DICT_TEMPLATE_UNESCAPED =
R"XAMLTL( new Dictionary<string, string>() R"XAMLTL( new Dictionary<string, string>()
......
...@@ -32,8 +32,7 @@ auto complexExample() { ...@@ -32,8 +32,7 @@ auto complexExample() {
DEFINE_ACTIVITY(TSConfigAndInterop, "PreRteg.InitiateBareMetalComplete") DEFINE_ACTIVITY(TSConfigAndInterop, "PreRteg.InitiateBareMetalComplete")
// All Names of activity should not contain quotation mark (") // All Names of activity should not contain quotation mark (")
Activity OneMoreMagicActivity("MyName Contains Symbols: {(<&>)}", "FleetAGC.Workflow.Magic"); Activity OneMoreMagicActivity("MyName Contains Symbols: {(&)} <>", "FleetAGC.Workflow.Magic");
OneMoreMagicActivity.explicitSetRawArgument("x:Boolean", "(0b_1100_1000 | 0b_1000_0001 == 201)");
auto block1 = SCS >> (SearchAnalytics | (SearchFarms >> (ClassisSearchUX | ModernSearch))); auto block1 = SCS >> (SearchAnalytics | (SearchFarms >> (ClassisSearchUX | ModernSearch)));
auto block3 = Loki >> Yggdrasil >> OfficeGraph; auto block3 = Loki >> Yggdrasil >> OfficeGraph;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment