HelloWorld.java
package org.example;
import de.asap.pak.jlcint.commandapi.CommandGroup;
import de.asap.pak.jlcint.commandapi.FieldScope;
import de.asap.pak.jlcint.commandapi.JavaCommand;
import de.asap.pak.jlcint.commandapi.Persistent;
import de.asap.pak.jlcint.commandapi.Run;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Sample implementation for a example command that input name and returns a simple output.
*
* The @JavaCommand annotation is necessary for the annotation processor to recognize this class as a command.
* If this is not set, no meta file will be generated!
*
* The @CommandGroup annotation is the described name that will be shown as group/cluster in the workflow editor.
*
* The @workflowDocu annotation describes what the element of the command is for. For classes it describes their
* whole purpose and for fields what are possible inputs and why you can do them.
*
*/
/**
* @workflowDocu Greets an entered name
*/
@JavaCommand
@CommandGroup("Example-Commands")
public class HelloWorld {
/**
* The LoggerFactory is a utility class producing Loggers for various logging APIs
*/
private static final Logger LOG = LoggerFactory.getLogger(HelloWorld.class);
/**
* The @Persistent annotation means that the value is read or saved from the data store. By default, any
* persistent variable is mandatory.
* This annotation provides many options, which are described in the JavaDoc.
*
*/
/**
* @workflowDocu Enter the name you want to greet
*/
@Persistent
private String input;
/**
*
* @workflowDocu The greeting
*/
@Persistent(scope = FieldScope.WRITE_ONLY)
private String output;
/**
* Methods that are annotated with @Run are executed when the task is called.
*
*/
@Run
public void run() {
this.output = "Hello " + input;
LOG.info(this.output);
}
}
Last updated 2024-12-19 10:07:56 +0100