Skip to content

CodePorting/java-to-apex-translator-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation and Setup Guide for the Java2Apex

Note

The application only works on Windows OS.

Setup environment

  1. Create an Account (Developer Organisation) in SalesForce.

    Registration Instructions

    Register an account at the following link: SalesForce Signup. Some countries are not eligible for SalesForce. If your country falls into this category, select another country in the sign up form.

    After registration, you will have access to your organization's own URL, for example:

    In the following instruction I will use https: //your-org.develop.my.salesforce.com in examples, but you should replace all the links with your organisation url.

    Save this URL for accessing your organization.

  2. Obtain Access (apiKey and URL) to the AI Service Based on OpenAI or DeepSeek.

    Access Instructions

    If connecting to api.openai.com, you will need an apiKey, which can be requested from a manager.
    If you are connecting to AI instances deployed within the company, an apiKey is not required.

  3. Install Salesforce CLI.

    Download it from the link: Salesforce CLI.
    Add to the environment variable PATH: C:\ your installation path \Salesforce\sfcli\bin`.

  4. Install IDE Extensions.

    • For Visual Studio Code, install the SalesForce extension pack.
    • For IntelliJ, install illuminatedCloud (it is paid).
  5. Manual Deployment.
    After translation, there will likely be compilation errors that need to be resolved manually.
    To do this, open the project in VSCode, right-click on the application name force-app/main/default/classes, and select SFDX: deploy this source to org.
    The script will start the compilation and highlight errors. If there are no errors, it will deploy to your developer organization on SalesForce.
    After successful deployment, you can view the deployed files at the link: https: //your-org.develop.my.salesforce.com/lightning/setup/ApexClasses/home If your application sends API requests to external services, the address must be registered in advance: https: //your-org.develop.my.salesforce.com/lightning/setup/SecurityRemoteProxy/home

Translator configuration

SFOrganisarion = your salesforce organisation url i.e. "your-org.develop.my.salesforce.com";
sourcePath = path to your translating java project root
targetPath = path to the folder where translated apex project will appear
projectName = translating project name
projectNamespace = The namespace is used when publishing to the AppExchanage
LLMEndpointUrl = utl to AI service i.e. "https://api.openai.com/v1/chat/completions"
apiKey = secret key of AI service. 
llmModel = choose one element from the range: "gpt-4o-mini", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "deepseek-r1"
temperature = LLM temperature 0.2f by default;
promptSystem = prompt describing a role of AI agent an common requirements.
promptTranslate = prompt describing translation requirements
promptFix = prompt describing compilation errors to be fixed in the translated apex code
maxRetryCount = how many times the AI will try to resolve compilation errors after main translation.

Running Tests

  • Go to SalesForce in the browser, open the Developer Console via the menu Test -> New Run, and select tests.
  • Tests (and any classes) can also be run using the menu Debug -> Open Execute Anonymous Window.
  • If tests use test files, they must be uploaded to the system in advance https: //your-org.develop.my.salesforce.com/lightning/o/ContentDocument/home.
    Apex unit tests are prohibited from calling external apis.

Useful Links

Please do not forget to update your own organization's URL in the followting links:

  • Class List: https: //your-org.develop.my.salesforce.com/lightning/setup/ApexClasses/home

  • File List: For example, if you need to use test files: https: //your-org.develop.my.salesforce.com/lightning/o/ContentDocument/home. By default, files are added without an extension, but you can add an extension to the file name.

  • External API Access Settings: If your application sends API requests to external services, the address must be registered in advance: https: //your-org.develop.my.salesforce.com/lightning/setup/SecurityRemoteProxy/home

  • Developer Console: Go to the Salesforce web page, click the gear icon in the upper right corner and select Developer Console from the context menu.

  • Developer Guide: For more details check out the Salesforce Apex Developer Guide

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages