Java tutorial
/* * 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 com.fasterxml.jackson.annotation.JsonProperty; import io.curly.commons.mongo.Auditor; import lombok.Data; import lombok.EqualsAndHashCode; import org.hibernate.validator.constraints.NotBlank; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import java.io.Serializable; import java.time.LocalDate; import java.util.HashSet; import java.util.Set; /** * @author Joao Pedro Evangelista * @since 19/04/2015 */ @Data @Document @EqualsAndHashCode(callSuper = false) @JsonIgnoreProperties(ignoreUnknown = true) public class Artifact extends Auditor implements Serializable { private static final long serialVersionUID = 8357768165966900756L; @Id 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; @NotBlank private String owner; public Artifact() { } public Artifact(String id) { this.id = id; this.author = ""; this.name = ""; this.homePage = ""; this.githubPage = ""; this.description = ""; this.languages = new HashSet<>(0); this.tags = new HashSet<>(0); this.category = new Category(); this.incubation = LocalDate.now().toString(); this.owner = ""; } public Artifact(String id, String author, String name, String homePage, String githubPage, String description, Set<Language> languages, Set<Tag> tags, Category category, String incubation, String owner) { this.id = id; this.author = author; this.name = name; this.homePage = homePage; this.githubPage = githubPage; this.description = description; this.languages = languages; this.tags = tags; this.category = category; this.incubation = incubation; this.owner = owner; } @JsonProperty("_id") public String getItemId() { return id; } }