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

io.zeebe.model.bpmn.impl.metadata.TaskHeadersImpl Maven / Gradle / Ivy

There is a newer version: 0.16.4
Show newest version
/*
 * Copyright © 2017 camunda services GmbH ([email protected])
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.zeebe.model.bpmn.impl.metadata;

import java.util.*;

import javax.xml.bind.annotation.XmlElement;

import io.zeebe.model.bpmn.BpmnConstants;
import io.zeebe.model.bpmn.impl.instance.BaseElement;
import io.zeebe.model.bpmn.instance.TaskHeaders;
import org.agrona.DirectBuffer;

public class TaskHeadersImpl extends BaseElement implements TaskHeaders
{
    private List taskHeaders = new ArrayList<>();

    private DirectBuffer buffer;

    @XmlElement(name = BpmnConstants.ZEEBE_ELEMENT_TASK_HEADER, namespace = BpmnConstants.ZEEBE_NS)
    public void setTaskHeaders(List taskHeaders)
    {
        this.taskHeaders = taskHeaders;
    }

    public List getTaskHeaders()
    {
        return taskHeaders;
    }

    public void setEncodedMsgpack(DirectBuffer buffer)
    {
        this.buffer = buffer;
    }

    @Override
    public DirectBuffer asMsgpackEncoded()
    {
        return buffer;
    }

    @Override
    public Map asMap()
    {
        final Map map = new HashMap<>();
        for (TaskHeaderImpl header : taskHeaders)
        {
            map.put(header.getKey(), header.getValue());
        }

        return map;
    }

    @Override
    public boolean isEmpty()
    {
        return taskHeaders.isEmpty();
    }

    @Override
    public String toString()
    {
        final StringBuilder builder = new StringBuilder();
        builder.append("TaskHeaders ");
        builder.append(asMap());
        return builder.toString();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy