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

org.aoju.bus.gitlab.hooks.web.EventChanges Maven / Gradle / Ivy

/*********************************************************************************
 *                                                                               *
 * The MIT License (MIT)                                                         *
 *                                                                               *
 * Copyright (c) 2015-2022 aoju.org Greg Messner and other contributors.         *
 *                                                                               *
 * Permission is hereby granted, free of charge, to any person obtaining a copy  *
 * of this software and associated documentation files (the "Software"), to deal *
 * in the Software without restriction, including without limitation the rights  *
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell     *
 * copies of the Software, and to permit persons to whom the Software is         *
 * furnished to do so, subject to the following conditions:                      *
 *                                                                               *
 * The above copyright notice and this permission notice shall be included in    *
 * all copies or substantial portions of the Software.                           *
 *                                                                               *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR    *
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,      *
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE   *
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER        *
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN     *
 * THE SOFTWARE.                                                                 *
 *                                                                               *
 ********************************************************************************/
package org.aoju.bus.gitlab.hooks.web;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import org.aoju.bus.gitlab.models.Assignee;
import org.aoju.bus.gitlab.support.JacksonJson;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public abstract class EventChanges {

    private ChangeContainer authorId;
    private ChangeContainer createdAt;
    private ChangeContainer updatedAt;
    private ChangeContainer updatedById;
    private ChangeContainer title;
    private ChangeContainer description;
    private ChangeContainer state;
    private ChangeContainer milestoneId;
    private ChangeContainer> labels;
    private ChangeContainer> assignees;
    private ChangeContainer totalTimeSpent;
    private Map> otherProperties = new LinkedHashMap<>();

    public ChangeContainer getAuthorId() {
        return authorId;
    }

    public void setAuthorId(ChangeContainer authorId) {
        this.authorId = authorId;
    }

    public ChangeContainer getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(ChangeContainer createdAt) {
        this.createdAt = createdAt;
    }

    public ChangeContainer getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(ChangeContainer updatedAt) {
        this.updatedAt = updatedAt;
    }

    public ChangeContainer getUpdatedById() {
        return updatedById;
    }

    public void setUpdatedById(ChangeContainer updatedById) {
        this.updatedById = updatedById;
    }

    public ChangeContainer getTitle() {
        return title;
    }

    public void setTitle(ChangeContainer title) {
        this.title = title;
    }

    public ChangeContainer getDescription() {
        return description;
    }

    public void setDescription(ChangeContainer description) {
        this.description = description;
    }

    public ChangeContainer getState() {
        return state;
    }

    public void setState(ChangeContainer state) {
        this.state = state;
    }

    public ChangeContainer getMilestoneId() {
        return milestoneId;
    }

    public void setMilestoneId(ChangeContainer milestoneId) {
        this.milestoneId = milestoneId;
    }

    public ChangeContainer> getLabels() {
        return labels;
    }

    public void setLabels(ChangeContainer> labels) {
        this.labels = labels;
    }

    public ChangeContainer> getAssignees() {
        return assignees;
    }

    public void setAssignees(ChangeContainer> assignees) {
        this.assignees = assignees;
    }

    public ChangeContainer getTotalTimeSpent() {
        return totalTimeSpent;
    }

    public void setTotalTimeSpent(ChangeContainer totalTimeSpent) {
        this.totalTimeSpent = totalTimeSpent;
    }

    public  ChangeContainer get(String property) {

        if (otherProperties.containsKey(property)) {
            try {
                final ChangeContainer container = otherProperties.get(property);
                return container != null ? (ChangeContainer) container : null;
            } catch (ClassCastException e) {
                return null;
            }
        } else {
            return null;
        }
    }

    @JsonAnyGetter
    public Map> any() {
        return this.otherProperties;
    }

    @JsonAnySetter
    public void set(String name, ChangeContainer value) {
        otherProperties.put(name, value);
    }

    @Override
    public String toString() {
        return (JacksonJson.toJsonString(this));
    }
}