User Manual

Java Data Source User Guide

23/9/26
Java Data Source User Guide

The Java data source is one of the integration methods on the Kuika platform that allows you to develop custom functions and business logic. Using Java, you can define custom operations within your application, create methods that accept parameters, and use these methods in application workflows.

With the Java data source, you can write custom code for needs not covered by predefined actions, customize data processing workflows, and create reusable functions.

Add a Data Source Connection to Your Application Using Java

  1. Log in to the Kuika platform and open the project you’ll be working on from the Apps screen.
  2. Open the Datasources module from the top menu.
  3. On the Datasources screen that opens, you can view your existing data sources under the Recently modified and Data sources tabs, and search using the Search by name field.
  4. Click the Create a Function card at the top of the screen. This card allows you to create custom functions using C#, TypeScript, Python, Java, Go, and Rust.
  5. From the Development list that opens, select the Java (Custom Java functions) option. You can use the ↑/↓ keys to navigate the list and the Enter key to make a selection.
  1. Enter a name for your data source in the Name field (e.g., userguidejava).
  2. Click the CREATE button to complete the process. To cancel the operation, use the CANCEL button; to return to the language selection, use the < Java link.

Note: You can also start the process of adding a new data source by clicking the + icon next to the Sources heading in the left panel.

Anatomy of the Java Editor Screen

A. Top Menu

  • Back Button (←): Takes you back to the Datasources screen.
  • Data Source Name: The name of the Java data source you created (e.g., userguidejava) is displayed alongside the Java icon. Use the drop-down arrow next to it to switch between data sources, and the pencil icon to edit the name.
  • CREATE Button: Used to save the Java data source you have created.

B. Editor Toolbar

  • Undo / Redo: Allows you to undo or redo changes.
  • Copy / Paste: Used to copy code and paste it into the editor.
  • Tidy Up Code: Use the magic wand icon to tidy up, align, and make the written code more readable.
  • Word Wrap: Turns on or off the automatic wrapping of long lines to the next line based on the editor’s width.
  • Font Size (− 12 +): Allows you to decrease or increase the font size in the editor; you can return to the default size using the icon next to it.
  • External Libraries (BETA): A drop-down menu that lets you add external libraries (JARs/dependencies) to use in your Java code. It is currently available as a BETA feature.
  • Java Version: A drop-down menu that lets you specify which Java version your code will be compiled and run with. Supported versions:
    • Java 21 (LTS)
    • Java 17 (LTS)
    • Java 11 (LTS)
    • Java 8 (LTS)
  • By default, the latest LTS version (Java 21) is selected; you can choose an older LTS version as needed. The green checkmark icon next to the menu indicates that your code is valid for the selected version.

C. Java Editor

This is the code editing area. All custom methods are defined here.

Default example structure:

java

public class Main {
public static String greet(String name) {
return “Hello, ” + name;
}
}

This structure demonstrates the following:

  • Code is defined within a class (default class name is Main).
  • Methods are declared as static.
  • They can accept parameters.
  • The parameter type can be specified (e.g., String).
  • The return type can be defined (e.g., String).

D. Kuika AI Panel

This is the AI assistant located on the right side of the screen. By typing your needs into the Type here... field, you can get code suggestions for your Java actions and use examples.

E. Test Console

This area, located at the bottom of the screen, is used to test the methods you’ve written. It can be opened and closed using the arrow on the right.

In this section:

  • A list of methods is displayed.
  • Parameter input fields are created.
  • The output result can be viewed.

Configuring Java Data Source Settings

Manual Code Writing

You can write your code manually directly in the editor.

Example:

java

public class Main {
public static String toUpperCase(String text) {
return text.toUpperCase();
}
}

Code Generation with Kuika AI

You can generate code automatically by entering a description in the Kuika AI field on the right panel.

Example command:

Create a method that converts the entered text to uppercase.

Selecting a Java Version

You can select the Java version in which your code will be compiled or run from the JAVA drop-down menu on the toolbar (see java_1.png). Since language features or library compatibility may vary between different versions, it is recommended that you select the LTS version appropriate for your project’s needs.

Using External Libraries (BETA)

Through the External Libraries drop-down menu, you can include additional dependencies in your project beyond the standard Java libraries. This feature is currently in the BETA phase.

Defining Parameters

You can add parameters to your methods.

Example:

java

public class Main {
public static double sum(double value1, double value2) {
return value1 + value2;
}
}

This method takes two numbers and returns their sum.

Specifying the Return Type

The return type must be specified at the beginning of the method definition. Example types: String, int, double, boolean, Object, List<T>.

Testing Methods with the Test Console

After writing your code, you can open and use the Test Console section below.

  1. Select the method you want to test.
  2. Enter sample data into the parameter fields.
  3. Run the method.
  4. Check the returned result.

Example:

java

public class Main {
public static String hello(String name) {
return “Hello ” + name;
}
}

Parameter: Kuika
Expected output: Hello Kuika

Saving the Data Source with CREATE

After completing and testing your code, you can save the Java data source by clicking the CREATE button in the top-right corner. The saved data source becomes available for use within the application.

Expected Output / Result

Once these steps are complete:

  • The Java data source is added to the Sources list.
  • The defined methods become available for use in the system.
  • Custom business rules can be managed via code.
  • A reusable function structure is created.
No items found.

Other Related Content

No items found.

Glossary

No items found.

Alt Başlıklar