All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netgrif.application.engine.workflow.domain.CachedFunction Maven / Gradle / Ivy

Go to download

System provides workflow management functions including user, role and data management.

There is a newer version: 6.3.3
Show newest version
package com.netgrif.application.engine.workflow.domain;

import com.netgrif.application.engine.petrinet.domain.Function;
import groovy.lang.Closure;
import groovy.lang.GroovyShell;
import lombok.Builder;
import lombok.Data;

@Builder
@Data
public class CachedFunction {

    private final Function function;
    private final Closure code;

    public static CachedFunction build(GroovyShell shell, Function function) {
        Closure code = (Closure) shell.evaluate(function.getDefinition());
        if (code == null) {
            throw new IllegalArgumentException("Non compilable function");
        }
        return CachedFunction.builder()
                .code(code)
                .function(function)
                .build();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy