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

add manual operation

parent 88e52afe
No related branches found
No related tags found
No related merge requests found
......@@ -25,16 +25,17 @@ namespace CIS {
private:
friend Flow;
virtual rlib::string generateXaml() const = 0;
public:
Flow operator>>(const Flow &seqNext) const;
Flow operator|(const Flow &seqNext) const;
};
class Activity : private ActivityBase {
class Activity : public ActivityBase {
public:
// All `Name` should not contain QuotationMark(")
Activity(string displayName, string className, string entityName = "")
: displayName(Utility::HtmlEscapeString(displayName)), className(className), entityName(entityName), taskId(Utility::GenUUID()) {}
Flow operator>>(const Flow &seqNext) const;
Flow operator|(const Flow &seqNext) const;
void addInputSetting(string k, string v) {
inputSettings[k] = v;
}
......@@ -55,7 +56,7 @@ namespace CIS {
auto inputSettingsString = ",\n"_rs.join(inputSettingStrings);
return rlib::string(templates::ACTIVITY_DICT_TEMPLATE_UNESCAPED).replace_once("__TEMPLATE_ARG_DictLines", inputSettingsString);
}
virtual rlib::string generateXaml() const {
virtual rlib::string generateXaml() const override {
rlib::string xamlCode;
if(inputSettings.empty()) {
......@@ -80,7 +81,27 @@ namespace CIS {
}
};
class ManualOperation : private ActivityBase {
class ManualOperation : public ActivityBase {
public:
explicit ManualOperation(string displayName, string message = "", string entityName = "")
: displayName(Utility::HtmlEscapeString(displayName)), messageInCSharp(Utility::HtmlEscapeString("\"" + message + "\"")), entityName(entityName) {}
ManualOperation &explicitSetMessageInCSharp(string messageInCSharp) {
this->messageInCSharp = messageInCSharp;
return *this;
}
private:
string displayName, messageInCSharp, entityName;
virtual rlib::string generateXaml() const override {
rlib::string xamlCode = templates::MANUAL_OPERATION_XAML;
xamlCode.replace_once("__TEMPLATE_ARG_DisplayName", displayName);
xamlCode.replace_once("__TEMPLATE_ARG_CodeLines", messageInCSharp);
auto entityXaml = this->entityName == "" ? "" : rlib::string(templates::ENTITY_DEF_TEMPLATE).replace("__TEMPLATE_ARG_EntityName", this->entityName);
xamlCode.replace_once("__TEMPLATE_ARG_EntityDefPlaceholder", entityXaml);
return xamlCode;
}
};
......@@ -89,7 +110,7 @@ namespace CIS {
Flow(const ActivityBase &activity) {
xamlCode = activity.generateXaml();
}
Flow(rlib::string xamlCode) : xamlCode(xamlCode) {}
explicit Flow(rlib::string xamlCode) : xamlCode(xamlCode) {}
Flow(const Flow &another) : queued(another.queued), xamlCode(another.xamlCode), prevOperationIsSequential(another.prevOperationIsSequential) {}
// Actually modify xamlCode on "OperationChange".
......@@ -131,10 +152,10 @@ namespace CIS {
}
};
inline Flow Activity::operator>>(const Flow &seqNext) const {
inline Flow ActivityBase::operator>>(const Flow &seqNext) const {
return Flow(*this) >> seqNext;
}
inline Flow Activity::operator|(const Flow &seqNext) const {
inline Flow ActivityBase::operator|(const Flow &seqNext) const {
return Flow(*this) | seqNext;
}
......@@ -147,7 +168,7 @@ namespace CIS {
std::list<string> xtraNamespaces;
std::list<string> xtraAssemblies;
string className;
Metadata(string className) : className(className) {}
explicit Metadata(string className) : className(className) {}
Metadata() = delete;
private:
......
......@@ -96,7 +96,7 @@ constexpr auto STD_XAML_TAIL = "</Activity>";
constexpr auto MANUAL_OPERATION_XAML =
R"XAML( <mwcwa:ManualOperation DeprecatedTaskId="{x:Null}" TaskId="{x:Null}" DisplayName="__TEMPLATE_ARG_DisplayName" MonitoringSystems="icm" WaitUntilFinish="True">
R"XAML( <mwcwa:ManualOperation DeprecatedTaskId="{x:Null}" TaskId="{x:Null}" DisplayName="__TEMPLATE_ARG_DisplayName" MonitoringSystems="icm" WaitUntilFinish="True" __TEMPLATE_ARG_EntityDefPlaceholder>
<mwcwa:ManualOperation.AdditionalContent>
<InArgument x:TypeArguments="x:String">
<mca:CSharpValue x:TypeArguments="x:String">__TEMPLATE_ARG_CodeLines</mca:CSharpValue>
......
#include "activity.hpp"
#include <cis-workflow-gen/quick-include.hpp>
auto simpleExample() {
......@@ -37,7 +38,7 @@ auto complexExample() {
auto block1 = SCS >> (SearchAnalytics | (SearchFarms >> (ClassisSearchUX | ModernSearch)));
auto block3 = Loki >> Yggdrasil >> OfficeGraph;
auto block4 = IC3Tooling >> (MonitoringSetup | (MicroServices >> DevelopmentValidation >> IntegrationTesting));
auto completeFlow = (block1 | TSConfigAndInterop | block3 | block4) >> OneMoreMagicActivity;
auto completeFlow = (block1 | TSConfigAndInterop | block3 | block4) >> OneMoreMagicActivity >> ManualOperation("Manual Op Test", "Message") >> ManualOperation("AnotherManual", "", "PreRteg.TestEntity").explicitSetMessageInCSharp("123.ToString()");
auto myMetadata = Metadata("FleetAGC.Workflows.BuildTeams").setXtraAssemblies({"FleetAGC.Workflows"});
println(to_file("BuildTeams.xaml"), completeFlow.generateXaml(myMetadata));
......
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