From 247b2ddfac1f1384ac4ae951a4a57c512438202a Mon Sep 17 00:00:00 2001 From: viogroza Date: Thu, 14 May 2026 20:13:50 +0300 Subject: [PATCH] Java: Add viewmodels [STUD-77111] Add viewmodels for java package --- .../Resources/ActivitiesMetadataPortable.json | 57 +++++++++ .../Resources/ActivitiesMetadataWindows.json | 90 +++++++------ .../UiPath.Java.Activities.ViewModels.csproj | 10 +- .../ViewModels/ConvertJavaObjectViewModel.cs | 38 ++++++ .../ViewModels/CreateJavaObjectViewModel.cs | 38 ++++++ .../ViewModels/GetJavaFieldViewModel.cs | 52 ++++++++ .../ViewModels/InvokeJavaMethodViewModel.cs | 52 ++++++++ .../ViewModels/JavaScopeViewModel.cs | 45 +++++++ .../ViewModels/LoadJarViewModel.cs | 31 +++++ .../UiPath.Java.Activities.Designer.cs | 118 +++++++++--------- .../UiPath.Java.Activities.csproj | 9 ++ Activities/Java/UiPath.Java/JavaInvoker.cs | 8 +- 12 files changed, 446 insertions(+), 102 deletions(-) create mode 100644 Activities/Java/UiPath.Java.Activities.ViewModels/Resources/ActivitiesMetadataPortable.json create mode 100644 Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/ConvertJavaObjectViewModel.cs create mode 100644 Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/CreateJavaObjectViewModel.cs create mode 100644 Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/GetJavaFieldViewModel.cs create mode 100644 Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/InvokeJavaMethodViewModel.cs create mode 100644 Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/JavaScopeViewModel.cs create mode 100644 Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/LoadJarViewModel.cs diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/Resources/ActivitiesMetadataPortable.json b/Activities/Java/UiPath.Java.Activities.ViewModels/Resources/ActivitiesMetadataPortable.json new file mode 100644 index 000000000..3491001e2 --- /dev/null +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/Resources/ActivitiesMetadataPortable.json @@ -0,0 +1,57 @@ +{ + "activities": [ + { + "fullName": "UiPath.Java.Activities.ConvertJavaObject`1", + "shortName": "ConvertJavaObject", + "displayNameKey": "ConvertJavaObjectDisplayName", + "descriptionKey": "ConvertJavaObjectDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.ConvertJavaObjectViewModel`1" + }, + { + "fullName": "UiPath.Java.Activities.JavaScope", + "shortName": "JavaScope", + "displayNameKey": "JavaScopeNameDisplayName", + "descriptionKey": "JavaScopeDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.JavaScopeViewModel" + }, + { + "fullName": "UiPath.Java.Activities.LoadJar", + "shortName": "LoadJar", + "displayNameKey": "LoadJarDisplayName", + "descriptionKey": "LoadJarDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.LoadJarViewModel" + }, + { + "fullName": "UiPath.Java.Activities.InvokeJavaMethod", + "shortName": "InvokeJavaMethod", + "displayNameKey": "InvokeJavaMethodDisplayName", + "descriptionKey": "InvokeJavaMethodDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.InvokeJavaMethodViewModel" + }, + { + "fullName": "UiPath.Java.Activities.CreateJavaObject", + "shortName": "CreateJavaObject", + "displayNameKey": "CreateJavaObjectDisplayName", + "descriptionKey": "CreateJavaObjectDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.CreateJavaObjectViewModel" + }, + { + "fullName": "UiPath.Java.Activities.GetJavaField", + "shortName": "GetJavaField", + "displayNameKey": "GetFieldDisplayName", + "descriptionKey": "GetFieldDescritption", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.GetJavaFieldViewModel" + } + ], + "defaultActivityNameBackgroundColor": "#00489D", + "defaultActivityColor": "#00489D", + "defaultActivityIconKey": "JavaIcon.svg", + "assemblyIconKey": "JavaIcon.svg", + "resourceManagerName": "UiPath.Java.Activities.Properties.UiPath.Java.Activities" +} diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/Resources/ActivitiesMetadataWindows.json b/Activities/Java/UiPath.Java.Activities.ViewModels/Resources/ActivitiesMetadataWindows.json index 984076058..235156195 100644 --- a/Activities/Java/UiPath.Java.Activities.ViewModels/Resources/ActivitiesMetadataWindows.json +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/Resources/ActivitiesMetadataWindows.json @@ -1,44 +1,54 @@ { - "additionalTypeCacheInfo": { - "legacyDesignerActivities": [ - { - "fullName": "UiPath.Java.Activities.ConvertJavaObject", - "displayNameKey": "ConvertJavaObjectDisplayName", - "descriptionKey": "ConvertJavaObjectDescription", - "iconKey": "JavaIcon.svg" - }, - { - "fullName": "UiPath.Java.Activities.CreateJavaObject", - "displayNameKey": "CreateJavaObjectDisplayName", - "descriptionKey": "CreateJavaObjectDescription", - "iconKey": "JavaIcon.svg" - }, - { - "fullName": "UiPath.Java.Activities.GetJavaField", - "displayNameKey": "GetFieldDisplayName", - "descriptionKey": "GetFieldDescritption", - "iconKey": "JavaIcon.svg" - }, - { - "fullName": "UiPath.Java.Activities.InvokeJavaMethod", - "displayNameKey": "InvokeJavaMethodDisplayName", - "descriptionKey": "InvokeJavaMethodDescription", - "iconKey": "JavaIcon.svg" - }, - { - "fullName": "UiPath.Java.Activities.JavaScope", - "displayNameKey": "JavaScopeNameDisplayName", - "descriptionKey": "JavaScopeDescription", - "iconKey": "JavaIcon.svg" - }, - { - "fullName": "UiPath.Java.Activities.LoadJar", - "displayNameKey": "LoadJarDisplayName", - "descriptionKey": "LoadJarDescription", - "iconKey": "JavaIcon.svg" - } - ] - }, + "activities": [ + { + "fullName": "UiPath.Java.Activities.ConvertJavaObject`1", + "shortName": "ConvertJavaObject", + "displayNameKey": "ConvertJavaObjectDisplayName", + "descriptionKey": "ConvertJavaObjectDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.ConvertJavaObjectViewModel`1" + }, + { + "fullName": "UiPath.Java.Activities.JavaScope", + "shortName": "JavaScope", + "displayNameKey": "JavaScopeNameDisplayName", + "descriptionKey": "JavaScopeDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.JavaScopeViewModel" + }, + { + "fullName": "UiPath.Java.Activities.LoadJar", + "shortName": "LoadJar", + "displayNameKey": "LoadJarDisplayName", + "descriptionKey": "LoadJarDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.LoadJarViewModel" + }, + { + "fullName": "UiPath.Java.Activities.InvokeJavaMethod", + "shortName": "InvokeJavaMethod", + "displayNameKey": "InvokeJavaMethodDisplayName", + "descriptionKey": "InvokeJavaMethodDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.InvokeJavaMethodViewModel" + }, + { + "fullName": "UiPath.Java.Activities.CreateJavaObject", + "shortName": "CreateJavaObject", + "displayNameKey": "CreateJavaObjectDisplayName", + "descriptionKey": "CreateJavaObjectDescription", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.CreateJavaObjectViewModel" + }, + { + "fullName": "UiPath.Java.Activities.GetJavaField", + "shortName": "GetJavaField", + "displayNameKey": "GetFieldDisplayName", + "descriptionKey": "GetFieldDescritption", + "iconKey": "JavaIcon.svg", + "viewModelType": "UiPath.Activities.Java.ViewModels.GetJavaFieldViewModel" + } + ], "defaultActivityNameBackgroundColor": "#00489D", "defaultActivityColor": "#00489D", "defaultActivityIconKey": "JavaIcon.svg", diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/UiPath.Java.Activities.ViewModels.csproj b/Activities/Java/UiPath.Java.Activities.ViewModels/UiPath.Java.Activities.ViewModels.csproj index 581f935a3..0a56d776d 100644 --- a/Activities/Java/UiPath.Java.Activities.ViewModels/UiPath.Java.Activities.ViewModels.csproj +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/UiPath.Java.Activities.ViewModels.csproj @@ -1,4 +1,4 @@ - + @@ -9,8 +9,16 @@ UiPath.Activities.Java.ViewModels + + + + + + + + diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/ConvertJavaObjectViewModel.cs b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/ConvertJavaObjectViewModel.cs new file mode 100644 index 000000000..5ff089574 --- /dev/null +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/ConvertJavaObjectViewModel.cs @@ -0,0 +1,38 @@ +using System.Activities.DesignViewModels; +using UiPath.Java; +using Resources = UiPath.Java.Activities.Properties.UiPath_Java_Activities; + +namespace UiPath.Activities.Java.ViewModels +{ + /// + /// ViewModel for the ConvertJavaObject activity. + /// + class ConvertJavaObjectViewModel : DesignPropertiesViewModel + { + public DesignInArgument JavaObject { get; set; } + public DesignOutArgument Result { get; set; } + + public ConvertJavaObjectViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + base.InitializeModel(); + + var orderIndex = 0; + JavaObject.OrderIndex = orderIndex++; + Result.OrderIndex = orderIndex++; + + JavaObject.DisplayName = Resources.JavaObjectDisplayName; + JavaObject.Tooltip = Resources.JavaObjectDescription; + JavaObject.Category = Resources.Input; + JavaObject.IsRequired = true; + JavaObject.IsPrincipal = true; + + Result.DisplayName = Resources.ResultDisplayName; + Result.Tooltip = Resources.ConvertJavaObjectResultDescription; + Result.Category = Resources.Output; + } + } +} diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/CreateJavaObjectViewModel.cs b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/CreateJavaObjectViewModel.cs new file mode 100644 index 000000000..6859766cb --- /dev/null +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/CreateJavaObjectViewModel.cs @@ -0,0 +1,38 @@ +using System.Activities.DesignViewModels; +using UiPath.Java; +using Resources = UiPath.Java.Activities.Properties.UiPath_Java_Activities; + +namespace UiPath.Activities.Java.ViewModels +{ + /// + /// ViewModel for the CreateJavaObject activity. + /// + class CreateJavaObjectViewModel : DesignPropertiesViewModel + { + public DesignInArgument TargetType { get; set; } + public DesignOutArgument Result { get; set; } + + public CreateJavaObjectViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + base.InitializeModel(); + + var orderIndex = 0; + TargetType.OrderIndex = orderIndex++; + Result.OrderIndex = orderIndex++; + + TargetType.DisplayName = Resources.TargetTypeDisplayName; + TargetType.Tooltip = Resources.TargetTypeDescription; + TargetType.Category = Resources.Target; + TargetType.IsRequired = true; + TargetType.IsPrincipal = true; + + Result.DisplayName = Resources.ResultDisplayName; + Result.Tooltip = Resources.JavaObjectDescription; + Result.Category = Resources.Output; + } + } +} diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/GetJavaFieldViewModel.cs b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/GetJavaFieldViewModel.cs new file mode 100644 index 000000000..392cb43f2 --- /dev/null +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/GetJavaFieldViewModel.cs @@ -0,0 +1,52 @@ +using System.Activities.DesignViewModels; +using UiPath.Java; +using Resources = UiPath.Java.Activities.Properties.UiPath_Java_Activities; + +namespace UiPath.Activities.Java.ViewModels +{ + /// + /// ViewModel for the GetJavaField activity. + /// + class GetJavaFieldViewModel : DesignPropertiesViewModel + { + public DesignInArgument FieldName { get; set; } + public DesignInArgument TargetObject { get; set; } + public DesignInArgument TargetType { get; set; } + public DesignOutArgument Result { get; set; } + + public GetJavaFieldViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + base.InitializeModel(); + + var orderIndex = 0; + FieldName.OrderIndex = orderIndex++; + TargetObject.OrderIndex = orderIndex++; + TargetType.OrderIndex = orderIndex++; + Result.OrderIndex = orderIndex++; + + FieldName.DisplayName = Resources.FieldNameDisplayName; + FieldName.Tooltip = Resources.FieldNameDescription; + FieldName.Category = Resources.Input; + FieldName.IsRequired = true; + FieldName.IsPrincipal = true; + + TargetObject.DisplayName = Resources.TargetObjectDisplayName; + TargetObject.Tooltip = Resources.TargetObjectDescription; + TargetObject.Category = Resources.Target; + TargetObject.IsPrincipal = true; + + TargetType.DisplayName = Resources.TargetTypeDisplayName; + TargetType.Tooltip = Resources.TargetTypeDescription; + TargetType.Category = Resources.Target; + TargetType.IsPrincipal = true; + + Result.DisplayName = Resources.ResultDisplayName; + Result.Tooltip = Resources.JavaObjectDescription; + Result.Category = Resources.Output; + } + } +} diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/InvokeJavaMethodViewModel.cs b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/InvokeJavaMethodViewModel.cs new file mode 100644 index 000000000..0dd4d2b3b --- /dev/null +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/InvokeJavaMethodViewModel.cs @@ -0,0 +1,52 @@ +using System.Activities.DesignViewModels; +using UiPath.Java; +using Resources = UiPath.Java.Activities.Properties.UiPath_Java_Activities; + +namespace UiPath.Activities.Java.ViewModels +{ + /// + /// ViewModel for the InvokeJavaMethod activity. + /// + class InvokeJavaMethodViewModel : DesignPropertiesViewModel + { + public DesignInArgument MethodName { get; set; } + public DesignInArgument TargetObject { get; set; } + public DesignInArgument TargetType { get; set; } + public DesignOutArgument Result { get; set; } + + public InvokeJavaMethodViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + base.InitializeModel(); + + var orderIndex = 0; + MethodName.OrderIndex = orderIndex++; + TargetObject.OrderIndex = orderIndex++; + TargetType.OrderIndex = orderIndex++; + Result.OrderIndex = orderIndex++; + + MethodName.DisplayName = Resources.MethodNameDisplayName; + MethodName.Tooltip = Resources.MethodNameDescription; + MethodName.Category = Resources.Input; + MethodName.IsRequired = true; + MethodName.IsPrincipal = true; + + TargetObject.DisplayName = Resources.TargetObjectDisplayName; + TargetObject.Tooltip = Resources.TargetObjectDescription; + TargetObject.Category = Resources.Target; + TargetObject.IsPrincipal = true; + + TargetType.DisplayName = Resources.TargetTypeDisplayName; + TargetType.Tooltip = Resources.TargetTypeDescription; + TargetType.Category = Resources.Target; + TargetType.IsPrincipal = true; + + Result.DisplayName = Resources.ResultDisplayName; + Result.Tooltip = Resources.JavaObjectDescription; + Result.Category = Resources.Output; + } + } +} diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/JavaScopeViewModel.cs b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/JavaScopeViewModel.cs new file mode 100644 index 000000000..8063171fa --- /dev/null +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/JavaScopeViewModel.cs @@ -0,0 +1,45 @@ +using System.Activities; +using System.Activities.DesignViewModels; +using UiPath.Studio.Activities.Api; +using Resources = UiPath.Java.Activities.Properties.UiPath_Java_Activities; + +namespace UiPath.Activities.Java.ViewModels +{ + /// + /// ViewModel for the JavaScope activity. + /// + class JavaScopeViewModel : DesignPropertiesViewModel + { + private readonly IWorkflowDesignApi _workflowDesignApi; + public DesignInArgument JavaPath { get; set; } + public DesignInArgument TimeoutMS { get; set; } + public DesignProperty> Body { get; set; } + + public JavaScopeViewModel(IDesignServices services) : base(services) + { + // Intentionally storing the IWorkflowDesignApi for potential future use, even though it's not currently used in this ViewModel. + // Actually this is a workaround to force the loading of the assembly (there is a known limitation https://uipath.atlassian.net/browse/STUD-73622) + _workflowDesignApi = services.GetService(); + } + + protected override void InitializeModel() + { + base.InitializeModel(); + + var orderIndex = 0; + Body.OrderIndex = orderIndex++; + JavaPath.OrderIndex = orderIndex++; + TimeoutMS.OrderIndex = orderIndex++; + + JavaPath.DisplayName = Resources.JavaPathDisplayName; + JavaPath.Tooltip = Resources.JavaPathDescription; + JavaPath.Category = Resources.Input; + + TimeoutMS.DisplayName = Resources.TimeoutMSDisplayName; + TimeoutMS.Tooltip = Resources.TimeoutMSDescription; + TimeoutMS.Category = Resources.Input; + + Body.IsVisible = false; + } + } +} diff --git a/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/LoadJarViewModel.cs b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/LoadJarViewModel.cs new file mode 100644 index 000000000..2197aa0d5 --- /dev/null +++ b/Activities/Java/UiPath.Java.Activities.ViewModels/ViewModels/LoadJarViewModel.cs @@ -0,0 +1,31 @@ +using System.Activities.DesignViewModels; +using Resources = UiPath.Java.Activities.Properties.UiPath_Java_Activities; + +namespace UiPath.Activities.Java.ViewModels +{ + /// + /// ViewModel for the LoadJar activity. + /// + class LoadJarViewModel : DesignPropertiesViewModel + { + public DesignInArgument JarPath { get; set; } + + public LoadJarViewModel(IDesignServices services) : base(services) + { + } + + protected override void InitializeModel() + { + base.InitializeModel(); + + var orderIndex = 0; + JarPath.OrderIndex = orderIndex++; + + JarPath.DisplayName = Resources.JarPathDisplayName; + JarPath.Tooltip = Resources.JarPathDescription; + JarPath.Category = Resources.Input; + JarPath.IsRequired = true; + JarPath.IsPrincipal = true; + } + } +} diff --git a/Activities/Java/UiPath.Java.Activities/Properties/UiPath.Java.Activities.Designer.cs b/Activities/Java/UiPath.Java.Activities/Properties/UiPath.Java.Activities.Designer.cs index 8ec5baca4..5513bf44f 100644 --- a/Activities/Java/UiPath.Java.Activities/Properties/UiPath.Java.Activities.Designer.cs +++ b/Activities/Java/UiPath.Java.Activities/Properties/UiPath.Java.Activities.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace UiPath.Java.Activities { +namespace UiPath.Java.Activities.Properties { using System; @@ -19,10 +19,10 @@ namespace UiPath.Java.Activities { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class UiPath_Java_Activities { + public class UiPath_Java_Activities { private static global::System.Resources.ResourceManager resourceMan; @@ -36,7 +36,7 @@ internal UiPath_Java_Activities() { /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UiPath.Java.Activities.Properties.UiPath.Java.Activities", typeof(UiPath_Java_Activities).Assembly); @@ -51,7 +51,7 @@ internal UiPath_Java_Activities() { /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -63,7 +63,7 @@ internal UiPath_Java_Activities() { /// /// Looks up a localized string similar to Constructor could not be called.. /// - internal static string ConstructorException { + public static string ConstructorException { get { return ResourceManager.GetString("ConstructorException", resourceCulture); } @@ -72,7 +72,7 @@ internal static string ConstructorException { /// /// Looks up a localized string similar to Could not convert . /// - internal static string ConvertException { + public static string ConvertException { get { return ResourceManager.GetString("ConvertException", resourceCulture); } @@ -81,7 +81,7 @@ internal static string ConvertException { /// /// Looks up a localized string similar to Convert a java object to the specified .net type. If the cast was not possible throws exception.. /// - internal static string ConvertJavaObjectDescription { + public static string ConvertJavaObjectDescription { get { return ResourceManager.GetString("ConvertJavaObjectDescription", resourceCulture); } @@ -90,7 +90,7 @@ internal static string ConvertJavaObjectDescription { /// /// Looks up a localized string similar to Convert Java Object. /// - internal static string ConvertJavaObjectDisplayName { + public static string ConvertJavaObjectDisplayName { get { return ResourceManager.GetString("ConvertJavaObjectDisplayName", resourceCulture); } @@ -99,7 +99,7 @@ internal static string ConvertJavaObjectDisplayName { /// /// Looks up a localized string similar to The java object converted to .net.. /// - internal static string ConvertJavaObjectResultDescription { + public static string ConvertJavaObjectResultDescription { get { return ResourceManager.GetString("ConvertJavaObjectResultDescription", resourceCulture); } @@ -108,7 +108,7 @@ internal static string ConvertJavaObjectResultDescription { /// /// Looks up a localized string similar to Invokes the constructor on the specified class.. /// - internal static string CreateJavaObjectDescription { + public static string CreateJavaObjectDescription { get { return ResourceManager.GetString("CreateJavaObjectDescription", resourceCulture); } @@ -117,7 +117,7 @@ internal static string CreateJavaObjectDescription { /// /// Looks up a localized string similar to Create Java Object. /// - internal static string CreateJavaObjectDisplayName { + public static string CreateJavaObjectDisplayName { get { return ResourceManager.GetString("CreateJavaObjectDisplayName", resourceCulture); } @@ -126,7 +126,7 @@ internal static string CreateJavaObjectDisplayName { /// /// Looks up a localized string similar to Do. /// - internal static string Do { + public static string Do { get { return ResourceManager.GetString("Do", resourceCulture); } @@ -135,7 +135,7 @@ internal static string Do { /// /// Looks up a localized string similar to Field Name. /// - internal static string FieldName { + public static string FieldName { get { return ResourceManager.GetString("FieldName", resourceCulture); } @@ -144,7 +144,7 @@ internal static string FieldName { /// /// Looks up a localized string similar to The name of the field the activity will return as a java object.. /// - internal static string FieldNameDescription { + public static string FieldNameDescription { get { return ResourceManager.GetString("FieldNameDescription", resourceCulture); } @@ -153,7 +153,7 @@ internal static string FieldNameDescription { /// /// Looks up a localized string similar to FieldName. /// - internal static string FieldNameDisplayName { + public static string FieldNameDisplayName { get { return ResourceManager.GetString("FieldNameDisplayName", resourceCulture); } @@ -162,7 +162,7 @@ internal static string FieldNameDisplayName { /// /// Looks up a localized string similar to Returns a public field from a java object.. /// - internal static string GetFieldDescritption { + public static string GetFieldDescritption { get { return ResourceManager.GetString("GetFieldDescritption", resourceCulture); } @@ -171,7 +171,7 @@ internal static string GetFieldDescritption { /// /// Looks up a localized string similar to Get Field. /// - internal static string GetFieldDisplayName { + public static string GetFieldDisplayName { get { return ResourceManager.GetString("GetFieldDisplayName", resourceCulture); } @@ -180,7 +180,7 @@ internal static string GetFieldDisplayName { /// /// Looks up a localized string similar to Field not found.. /// - internal static string GetFieldException { + public static string GetFieldException { get { return ResourceManager.GetString("GetFieldException", resourceCulture); } @@ -189,7 +189,7 @@ internal static string GetFieldException { /// /// Looks up a localized string similar to Input. /// - internal static string Input { + public static string Input { get { return ResourceManager.GetString("Input", resourceCulture); } @@ -198,7 +198,7 @@ internal static string Input { /// /// Looks up a localized string similar to The path to java library is invalid.. /// - internal static string InvalidJavaPath { + public static string InvalidJavaPath { get { return ResourceManager.GetString("InvalidJavaPath", resourceCulture); } @@ -207,7 +207,7 @@ internal static string InvalidJavaPath { /// /// Looks up a localized string similar to The Target Object and Target Type are both empty. At least one of them has to be set.. /// - internal static string InvokationObjectException { + public static string InvokationObjectException { get { return ResourceManager.GetString("InvokationObjectException", resourceCulture); } @@ -216,7 +216,7 @@ internal static string InvokationObjectException { /// /// Looks up a localized string similar to Invoke Java Method. /// - internal static string InvokeJavaMethodDescription { + public static string InvokeJavaMethodDescription { get { return ResourceManager.GetString("InvokeJavaMethodDescription", resourceCulture); } @@ -225,7 +225,7 @@ internal static string InvokeJavaMethodDescription { /// /// Looks up a localized string similar to Invoke Java Method. /// - internal static string InvokeJavaMethodDisplayName { + public static string InvokeJavaMethodDisplayName { get { return ResourceManager.GetString("InvokeJavaMethodDisplayName", resourceCulture); } @@ -234,7 +234,7 @@ internal static string InvokeJavaMethodDisplayName { /// /// Looks up a localized string similar to A reference to an object loaded in Java.. /// - internal static string InvokeJavaResultDescription { + public static string InvokeJavaResultDescription { get { return ResourceManager.GetString("InvokeJavaResultDescription", resourceCulture); } @@ -243,7 +243,7 @@ internal static string InvokeJavaResultDescription { /// /// Looks up a localized string similar to The method could not be invoked.. /// - internal static string InvokeMethodException { + public static string InvokeMethodException { get { return ResourceManager.GetString("InvokeMethodException", resourceCulture); } @@ -252,7 +252,7 @@ internal static string InvokeMethodException { /// /// Looks up a localized string similar to Path to the jar that will be loaded.. /// - internal static string JarPathDescription { + public static string JarPathDescription { get { return ResourceManager.GetString("JarPathDescription", resourceCulture); } @@ -261,7 +261,7 @@ internal static string JarPathDescription { /// /// Looks up a localized string similar to JarPath. /// - internal static string JarPathDisplayName { + public static string JarPathDisplayName { get { return ResourceManager.GetString("JarPathDisplayName", resourceCulture); } @@ -270,7 +270,7 @@ internal static string JarPathDisplayName { /// /// Looks up a localized string similar to Error intializing Java : {0}. /// - internal static string JavaInitiazeException { + public static string JavaInitiazeException { get { return ResourceManager.GetString("JavaInitiazeException", resourceCulture); } @@ -279,7 +279,7 @@ internal static string JavaInitiazeException { /// /// Looks up a localized string similar to Java invoker was not loaded.. /// - internal static string JavaInvokerNotLoadedException { + public static string JavaInvokerNotLoadedException { get { return ResourceManager.GetString("JavaInvokerNotLoadedException", resourceCulture); } @@ -288,7 +288,7 @@ internal static string JavaInvokerNotLoadedException { /// /// Looks up a localized string similar to JavaObject. /// - internal static string JavaObject { + public static string JavaObject { get { return ResourceManager.GetString("JavaObject", resourceCulture); } @@ -297,7 +297,7 @@ internal static string JavaObject { /// /// Looks up a localized string similar to A reference to an object loaded in Java.. /// - internal static string JavaObjectDescription { + public static string JavaObjectDescription { get { return ResourceManager.GetString("JavaObjectDescription", resourceCulture); } @@ -306,7 +306,7 @@ internal static string JavaObjectDescription { /// /// Looks up a localized string similar to JavaObject. /// - internal static string JavaObjectDisplayName { + public static string JavaObjectDisplayName { get { return ResourceManager.GetString("JavaObjectDisplayName", resourceCulture); } @@ -315,7 +315,7 @@ internal static string JavaObjectDisplayName { /// /// Looks up a localized string similar to Path to java.exe. /// - internal static string JavaPathDescription { + public static string JavaPathDescription { get { return ResourceManager.GetString("JavaPathDescription", resourceCulture); } @@ -324,7 +324,7 @@ internal static string JavaPathDescription { /// /// Looks up a localized string similar to JavaLibraryPath. /// - internal static string JavaPathDisplayName { + public static string JavaPathDisplayName { get { return ResourceManager.GetString("JavaPathDisplayName", resourceCulture); } @@ -333,7 +333,7 @@ internal static string JavaPathDisplayName { /// /// Looks up a localized string similar to Java Activities Container. /// - internal static string JavaScopeDescription { + public static string JavaScopeDescription { get { return ResourceManager.GetString("JavaScopeDescription", resourceCulture); } @@ -342,7 +342,7 @@ internal static string JavaScopeDescription { /// /// Looks up a localized string similar to Java Scope. /// - internal static string JavaScopeNameDisplayName { + public static string JavaScopeNameDisplayName { get { return ResourceManager.GetString("JavaScopeNameDisplayName", resourceCulture); } @@ -351,7 +351,7 @@ internal static string JavaScopeNameDisplayName { /// /// Looks up a localized string similar to Loads a jar in the current java scope.. /// - internal static string LoadJarDescription { + public static string LoadJarDescription { get { return ResourceManager.GetString("LoadJarDescription", resourceCulture); } @@ -360,7 +360,7 @@ internal static string LoadJarDescription { /// /// Looks up a localized string similar to Load Jar. /// - internal static string LoadJarDisplayName { + public static string LoadJarDisplayName { get { return ResourceManager.GetString("LoadJarDisplayName", resourceCulture); } @@ -369,7 +369,7 @@ internal static string LoadJarDisplayName { /// /// Looks up a localized string similar to Jar could not be loaded.. /// - internal static string LoadJarException { + public static string LoadJarException { get { return ResourceManager.GetString("LoadJarException", resourceCulture); } @@ -378,7 +378,7 @@ internal static string LoadJarException { /// /// Looks up a localized string similar to Method Name. /// - internal static string MethodName { + public static string MethodName { get { return ResourceManager.GetString("MethodName", resourceCulture); } @@ -387,7 +387,7 @@ internal static string MethodName { /// /// Looks up a localized string similar to The name of the method that will be executed in Java.. /// - internal static string MethodNameDescription { + public static string MethodNameDescription { get { return ResourceManager.GetString("MethodNameDescription", resourceCulture); } @@ -396,7 +396,7 @@ internal static string MethodNameDescription { /// /// Looks up a localized string similar to MethodName. /// - internal static string MethodNameDisplayName { + public static string MethodNameDisplayName { get { return ResourceManager.GetString("MethodNameDisplayName", resourceCulture); } @@ -405,7 +405,7 @@ internal static string MethodNameDisplayName { /// /// Looks up a localized string similar to Output. /// - internal static string Output { + public static string Output { get { return ResourceManager.GetString("Output", resourceCulture); } @@ -414,7 +414,7 @@ internal static string Output { /// /// Looks up a localized string similar to Output. /// - internal static string OutputDisplayName { + public static string OutputDisplayName { get { return ResourceManager.GetString("OutputDisplayName", resourceCulture); } @@ -423,7 +423,7 @@ internal static string OutputDisplayName { /// /// Looks up a localized string similar to The list of the arguments specified in the same order as the java method. An argument can not be null.. /// - internal static string ParametersDescription { + public static string ParametersDescription { get { return ResourceManager.GetString("ParametersDescription", resourceCulture); } @@ -432,7 +432,7 @@ internal static string ParametersDescription { /// /// Looks up a localized string similar to Parameters. /// - internal static string ParametersDisplayName { + public static string ParametersDisplayName { get { return ResourceManager.GetString("ParametersDisplayName", resourceCulture); } @@ -441,7 +441,7 @@ internal static string ParametersDisplayName { /// /// Looks up a localized string similar to ParametersList. /// - internal static string ParametersListDisplayName { + public static string ParametersListDisplayName { get { return ResourceManager.GetString("ParametersListDisplayName", resourceCulture); } @@ -450,7 +450,7 @@ internal static string ParametersListDisplayName { /// /// Looks up a localized string similar to Can not set both {0} and {1}.. /// - internal static string ParametersSetException { + public static string ParametersSetException { get { return ResourceManager.GetString("ParametersSetException", resourceCulture); } @@ -459,7 +459,7 @@ internal static string ParametersSetException { /// /// Looks up a localized string similar to Result. /// - internal static string ResultDisplayName { + public static string ResultDisplayName { get { return ResourceManager.GetString("ResultDisplayName", resourceCulture); } @@ -468,7 +468,7 @@ internal static string ResultDisplayName { /// /// Looks up a localized string similar to Target. /// - internal static string Target { + public static string Target { get { return ResourceManager.GetString("Target", resourceCulture); } @@ -477,7 +477,7 @@ internal static string Target { /// /// Looks up a localized string similar to The java object instace the method will be invoked. TargetObject and TargetType can not be set at the same time.. /// - internal static string TargetObjectDescription { + public static string TargetObjectDescription { get { return ResourceManager.GetString("TargetObjectDescription", resourceCulture); } @@ -486,7 +486,7 @@ internal static string TargetObjectDescription { /// /// Looks up a localized string similar to TargetObject. /// - internal static string TargetObjectDisplayName { + public static string TargetObjectDisplayName { get { return ResourceManager.GetString("TargetObjectDisplayName", resourceCulture); } @@ -495,7 +495,7 @@ internal static string TargetObjectDisplayName { /// /// Looks up a localized string similar to The name of the java class.. /// - internal static string TargetTypeDescription { + public static string TargetTypeDescription { get { return ResourceManager.GetString("TargetTypeDescription", resourceCulture); } @@ -504,7 +504,7 @@ internal static string TargetTypeDescription { /// /// Looks up a localized string similar to TargetType. /// - internal static string TargetTypeDisplayName { + public static string TargetTypeDisplayName { get { return ResourceManager.GetString("TargetTypeDisplayName", resourceCulture); } @@ -513,7 +513,7 @@ internal static string TargetTypeDisplayName { /// /// Looks up a localized string similar to The amount of time (in miliseconds) to wait for the Java runtime connection (default 15000ms).. /// - internal static string TimeoutMSDescription { + public static string TimeoutMSDescription { get { return ResourceManager.GetString("TimeoutMSDescription", resourceCulture); } @@ -522,7 +522,7 @@ internal static string TimeoutMSDescription { /// /// Looks up a localized string similar to Init timeout (milliseconds). /// - internal static string TimeoutMSDisplayName { + public static string TimeoutMSDisplayName { get { return ResourceManager.GetString("TimeoutMSDisplayName", resourceCulture); } @@ -531,7 +531,7 @@ internal static string TimeoutMSDisplayName { /// /// Looks up a localized string similar to The value provided for TimeoutMS must be >= 0. /// - internal static string TimeoutMSException { + public static string TimeoutMSException { get { return ResourceManager.GetString("TimeoutMSException", resourceCulture); } @@ -540,7 +540,7 @@ internal static string TimeoutMSException { /// /// Looks up a localized string similar to Activity is valid only inside {0}. /// - internal static string ValidateParentError { + public static string ValidateParentError { get { return ResourceManager.GetString("ValidateParentError", resourceCulture); } diff --git a/Activities/Java/UiPath.Java.Activities/UiPath.Java.Activities.csproj b/Activities/Java/UiPath.Java.Activities/UiPath.Java.Activities.csproj index 7de67ed60..9e2046f0f 100644 --- a/Activities/Java/UiPath.Java.Activities/UiPath.Java.Activities.csproj +++ b/Activities/Java/UiPath.Java.Activities/UiPath.Java.Activities.csproj @@ -23,6 +23,15 @@ UiPath.Java.Activities.resx + + True + True + UiPath.Java.Activities.resx + + + PublicResXFileCodeGenerator + UiPath.Java.Activities.Designer.cs + diff --git a/Activities/Java/UiPath.Java/JavaInvoker.cs b/Activities/Java/UiPath.Java/JavaInvoker.cs index ef7ef4d4f..7fbf380bd 100644 --- a/Activities/Java/UiPath.Java/JavaInvoker.cs +++ b/Activities/Java/UiPath.Java/JavaInvoker.cs @@ -22,7 +22,9 @@ public class JavaInvoker : IInvoker private const string _defaultJava = "java"; - private const string _pipePrefix = "dotnet_java_pipe_"; + private const string _pipePrefix = "djp_"; + + private static int _pipeIdx = 0; private static readonly string _defaultJavaInvokerPath = GetPathToJavaProgram(); @@ -168,7 +170,9 @@ private async Task SendJavaRequest(RequestType requestType, Cancella private static string GetNewPipeName() { - return _pipePrefix + Guid.NewGuid(); + //Generate a shorter pipe name to avoid hitting limitations regarding to pipe name max length, + //The new name is composed by a fixed prefix, the current process id and a number to avoid conflicts with other instances of the invoker. + return $"{_pipePrefix}_{Environment.ProcessId}_{Interlocked.Increment(ref _pipeIdx)}"; } private static string GetPathToJavaProgram()