global xml for demo
This commit is contained in:
Binary file not shown.
@@ -17,7 +17,10 @@
|
||||
<CompletitionPolicy Policy="Mandatory" Value="IfRequired" />
|
||||
<NotesMandatory Policy="Mandatory" Value="true" />
|
||||
<ShowOverview Policy="Mandatory" Value="false" />
|
||||
<OpenActivitiesExternally Policy="Mandatory" Value="false" />
|
||||
<OpenActivitiesExternally Policy="Mandatory" Value="false">
|
||||
<OpenActivityOverride ActivityType="SPSActivityTypeTicket" Value="false" />
|
||||
<OpenActivityOverride ActivityType="SPSActivityTypeServiceRequest" Value="true" />
|
||||
</OpenActivitiesExternally>
|
||||
<OverviewPollingPersonal Policy="Mandatory" Value="10" />
|
||||
<OverviewPollingRole Policy="Mandatory" Value="5" />
|
||||
</TicketConfiguration>
|
||||
|
||||
@@ -2811,65 +2811,100 @@ namespace C4IT.DataHistoryProvider
|
||||
return null;
|
||||
}
|
||||
|
||||
private async Task ProtocollSupportCaseProtocollEntries(List<ProtocollEntryBase> supportCaseProtocollEntries, Guid ticketId, cF4sdWebRequestInfo requestInfo, int logDeep, CancellationToken token)
|
||||
{
|
||||
foreach (var protocollEntry in supportCaseProtocollEntries)
|
||||
{
|
||||
if (!(protocollEntry is QuickActionProtocollEntry entry))
|
||||
continue;
|
||||
|
||||
cCreateJournalEntryInfo _entry = null;
|
||||
switch (entry.ResultCode)
|
||||
{
|
||||
case -1:
|
||||
case 1:
|
||||
case 0:
|
||||
var entryType = entry.WasRunningOnAffectedDevice ? 20602 : 20601;
|
||||
_entry = new cCreateJournalEntryInfo()
|
||||
{
|
||||
Comments = "",
|
||||
ObjectId = ticketId,
|
||||
EntryType = entryType,
|
||||
Parameters = new List<cCreateJournalEntryInfo.Parameter>() { new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "result",
|
||||
Value = entry.HtmlContent ?? entry.MeasureValues ?? entry.ErrorMessage
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "quickActionName",
|
||||
Value = entry.Name
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "QuickActionId",
|
||||
Value = entry.Id
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "quickActionExecutionType",
|
||||
Value = entry.ExecutionTypeId
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "ExecutionTime",
|
||||
Value = entry.Time
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "AffectedDeviceName",
|
||||
Value = entry.AffectedDeviceName
|
||||
},}
|
||||
};
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (_entry != null)
|
||||
{
|
||||
await CreateM42JournalAsync(_entry, requestInfo, logDeep + 1, token);
|
||||
if (token.IsCancellationRequested) return;
|
||||
}
|
||||
private async Task ProtocollSupportCaseProtocollEntries(List<ProtocollEntryBase> supportCaseProtocollEntries, Guid ticketId, cF4sdWebRequestInfo requestInfo, int logDeep, CancellationToken token)
|
||||
{
|
||||
foreach (var protocollEntry in supportCaseProtocollEntries.OrderBy(entry => entry.Time))
|
||||
{
|
||||
cCreateJournalEntryInfo _entry = null;
|
||||
if (protocollEntry is QuickActionProtocollEntry quickActionEntry)
|
||||
{
|
||||
switch (quickActionEntry.ResultCode)
|
||||
{
|
||||
case -1:
|
||||
case 1:
|
||||
case 0:
|
||||
var entryType = quickActionEntry.WasRunningOnAffectedDevice ? 20602 : 20601;
|
||||
_entry = new cCreateJournalEntryInfo()
|
||||
{
|
||||
Comments = "",
|
||||
ObjectId = ticketId,
|
||||
EntryType = entryType,
|
||||
Parameters = new List<cCreateJournalEntryInfo.Parameter>() { new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "result",
|
||||
Value = quickActionEntry.HtmlContent ?? quickActionEntry.MeasureValues ?? quickActionEntry.ErrorMessage
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "quickActionName",
|
||||
Value = quickActionEntry.Name
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "QuickActionId",
|
||||
Value = quickActionEntry.Id
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "quickActionExecutionType",
|
||||
Value = quickActionEntry.ExecutionTypeId
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "ExecutionTime",
|
||||
Value = quickActionEntry.Time
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "AffectedDeviceName",
|
||||
Value = quickActionEntry.AffectedDeviceName
|
||||
},}
|
||||
};
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (protocollEntry is QuickTipStepProtocollEntry quickTipEntry)
|
||||
{
|
||||
_entry = new cCreateJournalEntryInfo()
|
||||
{
|
||||
Comments = "",
|
||||
ObjectId = ticketId,
|
||||
EntryType = 20605,
|
||||
Parameters = new List<cCreateJournalEntryInfo.Parameter>() { new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "result",
|
||||
Value = quickTipEntry.HtmlContent ?? quickTipEntry.AsciiContent
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "quickTipName",
|
||||
Value = quickTipEntry.Name
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "QuickTipId",
|
||||
Value = quickTipEntry.Id
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "ExecutionTime",
|
||||
Value = quickTipEntry.Time
|
||||
},
|
||||
new cCreateJournalEntryInfo.Parameter()
|
||||
{
|
||||
Name = "WasSuccessfull",
|
||||
Value = quickTipEntry.WasSuccessfull
|
||||
},}
|
||||
};
|
||||
}
|
||||
|
||||
if (_entry != null)
|
||||
{
|
||||
await CreateM42JournalAsync(_entry, requestInfo, logDeep + 1, token);
|
||||
if (token.IsCancellationRequested) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,285 +58,12 @@ namespace C4IT.DataHistoryProvider
|
||||
|
||||
}
|
||||
|
||||
private cConfigHelperParameterList LoadParameters (XmlElement XRoot, cXmlParser Parser)
|
||||
{
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
|
||||
var _result = new cConfigHelperParameterList();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
var Items = XRoot.ChildNodes;
|
||||
foreach (var _node in Items)
|
||||
{
|
||||
if (!(_node is XmlElement _item)) continue;
|
||||
|
||||
Parser.EnterElement(_item.Name);
|
||||
|
||||
try
|
||||
{
|
||||
var _attPolicy = _item.GetAttribute("Policy");
|
||||
var _attValue = _item.GetAttribute("Value");
|
||||
|
||||
var _ElementCount = 0;
|
||||
foreach (XmlNode _subNode in _item.ChildNodes)
|
||||
{
|
||||
if (_subNode is XmlElement)
|
||||
_ElementCount++;
|
||||
}
|
||||
|
||||
// check for special parameters
|
||||
switch (_item.Name)
|
||||
{
|
||||
case "InformationClassSearchPriority":
|
||||
var _val = getInformationClassSearchPriority(_item, Parser);
|
||||
if (_val != null)
|
||||
_result.Items[_val.Name] = _val;
|
||||
continue;
|
||||
case "OpenActivitiesExternally":
|
||||
var _openActivitiesEntry = getOpenActivitiesExternallyEntry(_item);
|
||||
if (_openActivitiesEntry != null)
|
||||
_result.Items[_openActivitiesEntry.Name] = _openActivitiesEntry;
|
||||
|
||||
var _overrideValues = getOpenActivitiesExternallyOverrides(_item, Parser);
|
||||
if (_overrideValues != null && _overrideValues.ValueList != null && _overrideValues.ValueList.Count > 0)
|
||||
_result.Items[_overrideValues.Name] = _overrideValues;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_attPolicy != null && _attValue != null && _ElementCount == 0)
|
||||
{
|
||||
// we have a simple parameter
|
||||
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(_item, "Policy", enumConfigPolicy.Default);
|
||||
var _value = cXmlParser.GetStringFromXmlAttribute(_item, "Value", String.Empty);
|
||||
|
||||
_result.Items[_item.Name] = new cConfigHelperParameterEntry()
|
||||
{
|
||||
Name = _item.Name,
|
||||
Value = _value,
|
||||
Policy = _policy.ToString(),
|
||||
};
|
||||
}
|
||||
else if (string.IsNullOrEmpty(_attPolicy) && string.IsNullOrEmpty(_attValue) && _ElementCount > 0)
|
||||
{
|
||||
// we have a sublist
|
||||
if (_result.SubItems == null)
|
||||
_result.SubItems = new Dictionary<string, cConfigHelperParameterList>();
|
||||
_result.SubItems[_item.Name] = LoadParameters(_item, Parser);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we have an invalid entry
|
||||
var _msg = $"Invalid entry in F4SD-Global-Configuration.xml: {_item.Name}";
|
||||
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
||||
LogEntry(_msg, LogLevels.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Parser.LeaveElement(_item.Name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (CM != null) LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
return _result;
|
||||
}
|
||||
|
||||
private cConfigHelperParameterEntry getInformationClassSearchPriority(XmlElement XNode, cXmlParser Parser)
|
||||
private cConfigHelperParameterList LoadParameters (XmlElement XRoot, cXmlParser Parser)
|
||||
{
|
||||
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
|
||||
try
|
||||
{
|
||||
var _xNodes = XNode.ChildNodes;
|
||||
|
||||
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(XNode, "Policy", enumConfigPolicy.Default);
|
||||
|
||||
var _result = new List<string>();
|
||||
|
||||
foreach (var _xNode in _xNodes)
|
||||
{
|
||||
if (!(_xNode is XmlElement _item))
|
||||
continue;
|
||||
|
||||
Parser.EnterElement(_item.Name);
|
||||
|
||||
try
|
||||
{
|
||||
if (_item.Name != "InformationClass")
|
||||
{
|
||||
// we have an invalid entry
|
||||
var _msg = $"Invalid entry in F4SD-Global-Configuration.xml: {_item.Name}, should be <InformationClass/>";
|
||||
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
||||
LogEntry(_msg, LogLevels.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
var _InfoClass = cXmlParser.GetEnumFromAttribute<enumFasdInformationClass>(_item, "Type", enumFasdInformationClass.Unknown);
|
||||
if (_InfoClass == enumFasdInformationClass.Unknown)
|
||||
{
|
||||
// we have an invalid type attribute
|
||||
var _strType = cXmlParser.GetStringFromXmlAttribute(_item, "Type", String.Empty);
|
||||
var _msg = $"Invalid type attribute value ({_strType}) in entry {_item.Name}";
|
||||
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
||||
LogEntry(_msg, LogLevels.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
var _strInfoClass = _InfoClass.ToString();
|
||||
if (!_result.Contains(_strInfoClass))
|
||||
_result.Add(_strInfoClass);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Parser.LeaveElement(_item.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new cConfigHelperParameterEntry()
|
||||
{
|
||||
Name = XNode.Name,
|
||||
ValueList = _result,
|
||||
Policy = _policy.ToString()
|
||||
};
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (CM != null) LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static cConfigHelperParameterEntry getOpenActivitiesExternallyEntry(XmlElement XNode)
|
||||
{
|
||||
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(XNode, "Policy", enumConfigPolicy.Default);
|
||||
var _value = cXmlParser.GetStringFromXmlAttribute(XNode, "Value", String.Empty);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(_value))
|
||||
return null;
|
||||
|
||||
return new cConfigHelperParameterEntry()
|
||||
{
|
||||
Name = "OpenActivitiesExternally",
|
||||
Value = _value,
|
||||
Policy = _policy.ToString(),
|
||||
};
|
||||
}
|
||||
|
||||
private cConfigHelperParameterEntry getOpenActivitiesExternallyOverrides(XmlElement XNode, cXmlParser Parser)
|
||||
{
|
||||
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
|
||||
try
|
||||
{
|
||||
var _xNodes = XNode.ChildNodes;
|
||||
var _policy = cXmlParser.GetEnumFromAttribute<enumConfigPolicy>(XNode, "Policy", enumConfigPolicy.Default);
|
||||
var _result = new List<string>();
|
||||
|
||||
foreach (var _xNode in _xNodes)
|
||||
{
|
||||
if (!(_xNode is XmlElement _item))
|
||||
continue;
|
||||
|
||||
Parser.EnterElement(_item.Name);
|
||||
|
||||
try
|
||||
{
|
||||
if (_item.Name != "OpenActivityOverride")
|
||||
{
|
||||
var _msg = $"Invalid entry in F4SD-Global-Configuration.xml: {_item.Name}, should be <OpenActivityOverride/>";
|
||||
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
||||
LogEntry(_msg, LogLevels.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
var activityType = cXmlParser.GetStringFromXmlAttribute(_item, "ActivityType", String.Empty)?.Trim();
|
||||
if (string.IsNullOrWhiteSpace(activityType))
|
||||
{
|
||||
var _msg = $"Missing ActivityType attribute value in entry {_item.Name}";
|
||||
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
||||
LogEntry(_msg, LogLevels.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
var valueText = cXmlParser.GetStringFromXmlAttribute(_item, "Value", String.Empty)?.Trim();
|
||||
if (string.IsNullOrWhiteSpace(valueText))
|
||||
{
|
||||
var _msg = $"Missing Value attribute value in entry {_item.Name} ({activityType})";
|
||||
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
||||
LogEntry(_msg, LogLevels.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
var normalizedValue = valueText.ToLowerInvariant();
|
||||
bool? parsedValue = null;
|
||||
switch (normalizedValue)
|
||||
{
|
||||
case "true":
|
||||
case "1":
|
||||
case "yes":
|
||||
parsedValue = true;
|
||||
break;
|
||||
case "false":
|
||||
case "0":
|
||||
case "no":
|
||||
parsedValue = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!parsedValue.HasValue)
|
||||
{
|
||||
var _msg = $"Invalid Value attribute value ({valueText}) in entry {_item.Name} ({activityType})";
|
||||
Parser.AddMessage(_item, _msg, LogLevels.Warning);
|
||||
LogEntry(_msg, LogLevels.Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
_result.Add($"{activityType}={(parsedValue.Value ? "true" : "false")}");
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Parser.LeaveElement(_item.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return new cConfigHelperParameterEntry()
|
||||
{
|
||||
Name = "OpenActivitiesExternallyOverrides",
|
||||
ValueList = _result,
|
||||
Policy = _policy.ToString()
|
||||
};
|
||||
return cF4sdGlobalConfigParameterParser.Parse(XRoot, Parser);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
@@ -347,7 +74,7 @@ namespace C4IT.DataHistoryProvider
|
||||
if (CM != null) LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
return null;
|
||||
return new cConfigHelperParameterList();
|
||||
}
|
||||
|
||||
public override bool DoXmlUpdates(XmlElement XmlRoot, bool withM42Config = false, bool withIntuneConfig = false, bool withMobileDeviceConfig = false, bool withCitrixConfig = false)
|
||||
@@ -424,6 +151,16 @@ namespace C4IT.DataHistoryProvider
|
||||
, "OpenActivitiesExternally"
|
||||
, "<OpenActivitiesExternally Policy=\"Hidden\" Value=\"false\" />"
|
||||
);
|
||||
RetVal |= DoXmlInsertElement(XmlRoot
|
||||
, "TicketConfiguration/OpenActivitiesExternally"
|
||||
, "OpenActivityOverride[@ActivityType='SPSActivityTypeTicket']"
|
||||
, "<OpenActivityOverride ActivityType=\"SPSActivityTypeTicket\" Value=\"false\" />"
|
||||
);
|
||||
RetVal |= DoXmlInsertElement(XmlRoot
|
||||
, "TicketConfiguration/OpenActivitiesExternally"
|
||||
, "OpenActivityOverride[@ActivityType='SPSActivityTypeServiceRequest']"
|
||||
, "<OpenActivityOverride ActivityType=\"SPSActivityTypeServiceRequest\" Value=\"true\" />"
|
||||
);
|
||||
RetVal |= DoXmlInsertElement(XmlRoot
|
||||
, "TicketConfiguration"
|
||||
, "OverviewPollingPersonal"
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
<CompletitionPolicy Policy="Mandatory" Value="IfRequired" />
|
||||
<NotesMandatory Policy="Mandatory" Value="true" />
|
||||
<ShowOverview Policy="Mandatory" Value="false" />
|
||||
<OpenActivitiesExternally Policy="Mandatory" Value="false" />
|
||||
<OpenActivitiesExternally Policy="Mandatory" Value="false">
|
||||
<OpenActivityOverride ActivityType="SPSActivityTypeTicket" Value="false" />
|
||||
<OpenActivityOverride ActivityType="SPSActivityTypeServiceRequest" Value="true" />
|
||||
</OpenActivitiesExternally>
|
||||
<OverviewPollingPersonal Policy="Mandatory" Value="10" />
|
||||
<OverviewPollingRole Policy="Mandatory" Value="5" />
|
||||
</TicketConfiguration>
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
<CompletitionPolicy Policy="Mandatory" Value="IfRequired" />
|
||||
<NotesMandatory Policy="Mandatory" Value="true" />
|
||||
<ShowOverview Policy="Mandatory" Value="false" />
|
||||
<OpenActivitiesExternally Policy="Mandatory" Value="false" />
|
||||
<OpenActivitiesExternally Policy="Mandatory" Value="false">
|
||||
<OpenActivityOverride ActivityType="SPSActivityTypeTicket" Value="false" />
|
||||
<OpenActivityOverride ActivityType="SPSActivityTypeServiceRequest" Value="true" />
|
||||
</OpenActivitiesExternally>
|
||||
<OverviewPollingPersonal Policy="Mandatory" Value="10" />
|
||||
<OverviewPollingRole Policy="Mandatory" Value="5" />
|
||||
</TicketConfiguration>
|
||||
|
||||
Reference in New Issue
Block a user