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

io.takari.bpm.model.ProcessDefinition Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package io.takari.bpm.model;

import java.util.*;

public class ProcessDefinition extends AbstractElement {

    private static final long serialVersionUID = 1L;

    public static final String SOURCE_TYPE_ATTRIBUTE = "sourceType";
    public static final String ATTRIBUTE_KEY_PREFIX = "__attr_";

    private String name;

    private final Map entities;
    private final Map attributes;

    public ProcessDefinition(ProcessDefinition source, Map attributes) {
        this(source.getId(), source.getChildren(), attributes);
    }

    public ProcessDefinition(String id, AbstractElement... children) {
        this(id, Arrays.asList(children));
    }

    public ProcessDefinition(String id, Collection children) {
        this(id, children, Collections.emptyMap());
    }

    public ProcessDefinition(String id, Collection children, Map attributes) {
        super(id);

        Map m = new LinkedHashMap<>();
        if (children != null) {
            for (AbstractElement c : children) {
                m.put(c.getId(), c);
            }
        }

        this.entities = Collections.unmodifiableMap(m);
        this.attributes = Collections.unmodifiableMap(new HashMap<>(attributes));
    }

    public AbstractElement getChild(String id) {
        return entities.get(id);
    }

    public boolean hasChild(String id) {
        return entities.containsKey(id);
    }

    public Collection getChildren() {
        return entities.values();
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String getAttribute(String key) {
        return attributes.get(key);
    }

    public Map getAttributes() {
        return attributes;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy