diff --git a/cmf-cli/Factories/PackageTypeFactory.cs b/cmf-cli/Factories/PackageTypeFactory.cs
index 642b6559a..ff60addba 100644
--- a/cmf-cli/Factories/PackageTypeFactory.cs
+++ b/cmf-cli/Factories/PackageTypeFactory.cs
@@ -1,5 +1,4 @@
-
-using Cmf.CLI.Core;
+using Cmf.CLI.Core;
using Cmf.CLI.Core.Enums;
using Cmf.CLI.Core.Interfaces;
using Cmf.CLI.Core.Objects;
@@ -64,7 +63,13 @@ public static IPackageTypeHandler GetPackageTypeHandler(CmfPackage cmfPackage, b
PackageType.ExportedObjects => new ExportedObjectsPackageTypeHandler(cmfPackage),
PackageType.Database => new DatabasePackageTypeHandler(cmfPackage),
PackageType.Tests => new TestPackageTypeHandler(cmfPackage),
- PackageType.SecurityPortal => SecurityPortalHandler(cmfPackage),
+ PackageType.SecurityPortal => cmfPackage.HandlerVersion switch
+ {
+ 3 => new SecurityPortalPackageTypeHandlerV3(cmfPackage),
+ 2 => new SecurityPortalPackageTypeHandlerV2(cmfPackage),
+ 1 => new SecurityPortalPackageTypeHandler(cmfPackage),
+ _ => SecurityPortalHandler(cmfPackage)
+ },
PackageType.Grafana => new GrafanaPackageTypeHandler(cmfPackage),
_ => throw new CliException(string.Format(CoreMessages.PackageTypeHandlerNotImplemented, cmfPackage.PackageType.ToString()))
};
@@ -98,7 +103,7 @@ private static IPackageTypeHandler HtmlHandler(CmfPackage cmfPackage)
///
/// Creates the specific Security Portal package handler.
- ///
+ ///
/// If the ProjectConfig's MESVersion is less than 10.0.0, a is created and returned.
/// Otherwise, a is created and returned.
///
@@ -108,6 +113,7 @@ private static IPackageTypeHandler SecurityPortalHandler(CmfPackage cmfPackage)
{
var targetVersion = ExecutionContext.Instance.ProjectConfig.MESVersion;
var minimumVersion = new Version("10.0.0");
+
if (targetVersion.CompareTo(minimumVersion) < 0)
{
return new SecurityPortalPackageTypeHandler(cmfPackage);
@@ -116,4 +122,4 @@ private static IPackageTypeHandler SecurityPortalHandler(CmfPackage cmfPackage)
return new SecurityPortalPackageTypeHandlerV2(cmfPackage);
}
}
-}
+}
\ No newline at end of file
diff --git a/cmf-cli/Handlers/PackageType/SecurityPortalPackageTypeHandlerV3.cs b/cmf-cli/Handlers/PackageType/SecurityPortalPackageTypeHandlerV3.cs
new file mode 100644
index 000000000..f99b36499
--- /dev/null
+++ b/cmf-cli/Handlers/PackageType/SecurityPortalPackageTypeHandlerV3.cs
@@ -0,0 +1,70 @@
+using Cmf.CLI.Constants;
+using Cmf.CLI.Core;
+using Cmf.CLI.Core.Enums;
+using Cmf.CLI.Core.Objects;
+using Cmf.CLI.Utilities;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Abstractions;
+
+namespace Cmf.CLI.Handlers
+{
+ public class SecurityPortalPackageTypeHandlerV3 : PackageTypeHandler
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ public SecurityPortalPackageTypeHandlerV3(CmfPackage cmfPackage) : base(cmfPackage)
+ {
+ cmfPackage.SetDefaultValues
+ (
+ targetDirectory:
+ "SecurityPortal",
+ targetLayer:
+ "securityportal",
+ steps:
+ new List
+ {
+ new(StepType.TransformFile)
+ {
+ File = "config.json",
+ TagFile = true,
+ RelativePath = "./src/"
+ }
+ }
+ );
+
+ cmfPackage.DFPackageType = PackageType.Business;
+ }
+
+ ///
+ /// Packs the specified package output dir.
+ ///
+ /// The package output dir.
+ /// The output dir.
+ public override void Pack(IDirectoryInfo packageOutputDir, IDirectoryInfo outputDir)
+ {
+ Log.Debug("Generating SecurityPortal package");
+ string path = $"{packageOutputDir.FullName}{Path.DirectorySeparatorChar}{CliConstants.CmfPackageSecurityPortalConfig}";
+
+ IDirectoryInfo cmfPackageDirectory = CmfPackage.GetFileInfo().Directory;
+
+ dynamic configJson = cmfPackageDirectory.GetFile(CliConstants.CmfPackageSecurityPortalConfig);
+
+ if (configJson != null)
+ {
+ GenerateDeploymentFrameworkManifest(packageOutputDir);
+
+ FinalArchive(packageOutputDir, outputDir);
+
+ Log.Debug($"{outputDir.FullName}{Path.DirectorySeparatorChar}{CmfPackage.ZipPackageName} created");
+ Log.Information($"{CmfPackage.PackageName} packed");
+ }
+ else
+ {
+ throw new CliException("No config.json was provided");
+ }
+ }
+ }
+}
\ No newline at end of file