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

io.automatiko.engine.service.dev.WorkflowInfoSupplier Maven / Gradle / Ivy

The newest version!
package io.automatiko.engine.service.dev;

import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Supplier;

import io.automatiko.engine.api.workflow.Process;
import io.automatiko.engine.workflow.AbstractProcess;
import io.automatiko.engine.workflow.process.core.WorkflowProcess;
import io.quarkus.arc.Arc;
import jakarta.enterprise.inject.Any;
import jakarta.enterprise.util.AnnotationLiteral;
import jakarta.enterprise.util.TypeLiteral;

public class WorkflowInfoSupplier implements Supplier> {

    @SuppressWarnings("serial")
    @Override
    public Collection get() {
        Collection processes = new ArrayList();

        Arc.container().select(new TypeLiteral>() {
        }, new AnnotationLiteral() {
        }).forEach(p -> {
            processes.add(new WorkflowInfo(p.id(), p.name(), isPublic(p),
                    (String) ((AbstractProcess) p).process().getMetaData().get("Documentation")));
        });

        return processes;
    }

    private boolean isPublic(Process p) {
        String visibility = ((WorkflowProcess) ((AbstractProcess) p).process()).getVisibility();

        if (WorkflowProcess.PUBLIC_VISIBILITY.equals(visibility) || WorkflowProcess.NONE_VISIBILITY.equals(visibility)) {
            return true;
        }

        return false;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy