io.curly.artifact.model.ArtifactReqBody.java Source code

Java tutorial

Introduction

Here is the source code for io.curly.artifact.model.ArtifactReqBody.java

Source

/*
 *        Copyright 2015 the original author or authors.
 *
 *    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.curly.artifact.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.curly.commons.github.User;
import org.springframework.util.Assert;

import java.io.Serializable;
import java.util.Set;

/**
 * @author Joo Pedro Evangelista
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class ArtifactReqBody implements Serializable {
    private static final long serialVersionUID = 8357768165966900756L;

    private String id;

    private String author;

    private String name;

    private String description;

    private String homePage;

    private String githubPage;

    private Set<Language> languages;

    private Set<Tag> tags;

    private Category category;

    private String incubation;

    public Artifact toArtifact(User user) {
        Assert.notNull(user, "User must be not null!");
        return new Artifact(this.id, this.author, this.name, this.homePage, this.githubPage, this.description,
                this.languages, this.tags, this.category, this.incubation, user.getId());
    }

}