Skip to content

Commit 9916b08

Browse files
authored
Merge branch 'develop' into issue_2973
2 parents 92655f2 + 5c78f79 commit 9916b08

File tree

12 files changed

+667
-78
lines changed

12 files changed

+667
-78
lines changed

roles/lib/files/FWO.Api.Client/APIcalls/request/subscribeTicketStateChanges.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
subscription subscribeTicketStateChanges ($id: bigint!){
22
request_ticket(where: { id: {_eq: $id} }, limit:1) {
33
id
4+
date_created
45
date_completed
56
state_id
67
requester: uiuser {

roles/lib/files/FWO.Data/Modelling/ModellingAppServer.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,16 @@ public static ModellingAppServer[] Resolve(List<ModellingAppServerWrapper> wrapp
107107
{
108108
return Array.ConvertAll(wrappedList.ToArray(), wrapper => wrapper.Content);
109109
}
110+
111+
/// <summary>
112+
/// Converts an array of ModellingAppServer objects to a list of ModellingAppServerWrapper objects
113+
/// </summary>
114+
/// <param name="appServers"></param>
115+
/// <returns></returns>
116+
public static List<ModellingAppServerWrapper> Wrap(ModellingAppServer[] appServers)
117+
{
118+
ModellingAppServerWrapper[] wrappedArray = Array.ConvertAll(appServers, appServer => new ModellingAppServerWrapper(){Content = appServer});
119+
return wrappedArray.ToList();
120+
}
110121
}
111122
}

roles/lib/files/FWO.Services/AppServerComparer.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,18 @@ public bool Equals(ModellingAppServer? appServer1, ModellingAppServer? appServer
2626
}
2727

2828
string appServer2Name = AppServerHelper.ConstructAppServerName(appServer2, NamingConvention);
29-
bool shortened = false;
30-
string sanitizedAS2Name = Sanitizer.SanitizeJsonFieldMand(new(appServer2Name), ref shortened);
31-
return appServer1.Name.Trim() == appServer2Name.Trim() || appServer1.Name.Trim() == sanitizedAS2Name.Trim();
29+
return appServer1.Name.Trim() == appServer2Name.Trim(); // || appServer1.Name.Trim() == sanitizedAS2Name.Trim();
3230
}
3331

3432
public int GetHashCode(ModellingAppServerWrapper appServerWrapper)
3533
{
36-
if (appServerWrapper is null) return 0;
37-
int hash = appServerWrapper == null ? 0 : appServerWrapper.GetHashCode();
38-
int hashContent = appServerWrapper?.Content == null ? 0 : appServerWrapper.Content.GetHashCode();
39-
return hash ^ hashContent;
34+
return appServerWrapper == null ? 0 : GetHashCode(appServerWrapper.Content);
4035
}
4136

42-
public int GetHashCode([DisallowNull] ModellingAppServer obj)
37+
public int GetHashCode(ModellingAppServer appServer)
4338
{
44-
throw new NotImplementedException();
39+
string appServerName = AppServerHelper.ConstructAppServerName(appServer, NamingConvention).Trim();
40+
return HashCode.Combine(appServerName);
4541
}
4642
}
4743
}

roles/lib/files/FWO.Services/NetworkObjectComparer.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public bool Equals(NetworkObject? nwObject1, NetworkObject? nwObject2)
1818
return false;
1919
}
2020

21-
return option.NwRegardIp ? nwObject1.IP == nwObject2.IP && nwObject1.IpEnd == nwObject2.IpEnd : true
22-
&& option.NwRegardName ? nwObject1.Name == nwObject2.Name : true;
21+
return (option.NwRegardIp ? nwObject1.IP == nwObject2.IP && nwObject1.IpEnd == nwObject2.IpEnd : true)
22+
&& (option.NwRegardName ? nwObject1.Name == nwObject2.Name : true);
2323
}
2424

2525
public int GetHashCode(NetworkObject nwObject)
@@ -67,9 +67,12 @@ public int GetHashCode(NetworkObject nwObject)
6767
{
6868
int hashCode = 0;
6969

70-
foreach(var obj in nwObject.ObjectGroupFlats.Where(o => o.Object?.Type.Name != ObjectType.Group).ToList())
70+
if(!option.NwSeparateGroupAnalysis)
7171
{
72-
hashCode ^= obj.Object != null ? networkObjectComparer.GetHashCode(obj.Object) : 0;
72+
foreach(var obj in nwObject.ObjectGroupFlats.Where(o => o.Object?.Type.Name != ObjectType.Group).ToList())
73+
{
74+
hashCode ^= obj.Object != null ? networkObjectComparer.GetHashCode(obj.Object) : 0;
75+
}
7376
}
7477
return hashCode ^ (option.NwRegardGroupName ?
7578
HashCode.Combine(nwObject.Type.Name, nwObject.Name) :

roles/lib/files/FWO.Services/NetworkServiceComparer.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using FWO.Data;
1+
using FWO.Basics;
2+
using FWO.Data;
23
using FWO.Data.Modelling;
34

45
namespace FWO.Services
@@ -17,10 +18,10 @@ public bool Equals(NetworkService? service1, NetworkService? service2)
1718
return false;
1819
}
1920

20-
return option.SvcRegardPortAndProt ? service1.ProtoId == service2.ProtoId
21+
return (option.SvcRegardPortAndProt ? service1.ProtoId == service2.ProtoId
2122
&& service1.DestinationPort == service2.DestinationPort
22-
&& service1.DestinationPortEnd == service2.DestinationPortEnd : true
23-
&& option.SvcRegardName ? service1.Name == service2.Name : true;
23+
&& service1.DestinationPortEnd == service2.DestinationPortEnd : true)
24+
&& (option.SvcRegardName ? service1.Name == service2.Name : true);
2425
}
2526

2627
public int GetHashCode(NetworkService service)
@@ -32,6 +33,8 @@ public int GetHashCode(NetworkService service)
3233

3334
public class NetworkServiceGroupComparer(RuleRecognitionOption option) : IEqualityComparer<NetworkService?>
3435
{
36+
NetworkServiceComparer networkServiceComparer = new(option);
37+
3538
public bool Equals(NetworkService? service1, NetworkService? service2)
3639
{
3740
if (ReferenceEquals(service1, service2))
@@ -50,23 +53,20 @@ public bool Equals(NetworkService? service1, NetworkService? service2)
5053
return false;
5154
}
5255

53-
NetworkServiceComparer networkServiceComparer = new(option);
5456
return service1.ServiceGroupFlats.ToList().ConvertAll(g => g.Object).ToList()
5557
.Except([.. service2.ServiceGroupFlats.ToList().ConvertAll(g => g.Object)], networkServiceComparer).ToList().Count == 0
5658
&& service2.ServiceGroupFlats.ToList().ConvertAll(g => g.Object).ToList()
5759
.Except([.. service1.ServiceGroupFlats.ToList().ConvertAll(g => g.Object)], networkServiceComparer).ToList().Count == 0;
5860
}
5961

60-
public int GetHashCode(NetworkService service)
62+
public int GetHashCode(NetworkService serviceGrp)
6163
{
6264
int hashCode = 0;
63-
foreach(var obj in service.ServiceGroupFlats)
65+
foreach(var svc in serviceGrp.ServiceGroupFlats.Where(s => s.Object?.Type.Name != ServiceType.Group).ToList())
6466
{
65-
hashCode ^= obj.GetHashCode();
67+
hashCode ^= (svc.Object != null ? networkServiceComparer.GetHashCode(svc.Object) : 0);
6668
}
67-
return hashCode ^ (option.SvcRegardGroupName ?
68-
HashCode.Combine(service.TypeId, service.Name) :
69-
HashCode.Combine(service.TypeId));
69+
return hashCode ^ (option.SvcRegardGroupName ? HashCode.Combine(serviceGrp.Name) : 0);
7070
}
7171
}
7272
}

0 commit comments

Comments
 (0)