001/*-------------------------------------------------------------------------+ 002| | 003| Copyright (c) 2009-2019 CQSE GmbH | 004| | 005+-------------------------------------------------------------------------*/ 006package org.conqat.engine.index.shared; 007 008import java.io.Serializable; 009import java.util.Objects; 010 011import org.conqat.lib.commons.js_export.ExportToJavaScript; 012 013import com.fasterxml.jackson.annotation.JsonCreator; 014import com.fasterxml.jackson.annotation.JsonProperty; 015 016/** 017 * Holds information about the creator and the creation date of an architecture 018 * as well as the name of the user who last modified the architecture and the 019 * modification date. 020 */ 021@ExportToJavaScript 022public class ArchitectureCreationModificationInfo implements Serializable { 023 024 private static final long serialVersionUID = 1L; 025 026 /** The name of the JSON property name for {@link #createdBy}. */ 027 private static final String CREATED_BY_PROPERTY = "createdBy"; 028 029 /** The name of the JSON property name for {@link #creationDate}. */ 030 private static final String CREATION_DATE_PROPERTY = "creationDate"; 031 032 /** The name of the JSON property name for {@link #lastModifiedBy}. */ 033 private static final String LAST_MODIFIED_BY_PROPERTY = "lastModifiedBy"; 034 035 /** The name of the JSON property name for {@link #modificationDate}. */ 036 private static final String MODIFICATION_DATE_PROPERTY = "modificationDate"; 037 038 /** The name of the creator of this architecture. */ 039 @JsonProperty(CREATED_BY_PROPERTY) 040 private String createdBy; 041 042 /** The date the architecture was created as timestamp. */ 043 @JsonProperty(CREATION_DATE_PROPERTY) 044 private Long creationDate; 045 046 /** 047 * The name of the user, who applied the last modification to the architecture. 048 */ 049 @JsonProperty(LAST_MODIFIED_BY_PROPERTY) 050 private String lastModifiedBy; 051 052 /** The date the last modification was made as timestamp. */ 053 @JsonProperty(MODIFICATION_DATE_PROPERTY) 054 private Long modificationDate; 055 056 @JsonCreator 057 public ArchitectureCreationModificationInfo(@JsonProperty(CREATED_BY_PROPERTY) String createdBy, 058 @JsonProperty(CREATION_DATE_PROPERTY) Long creationDate, 059 @JsonProperty(LAST_MODIFIED_BY_PROPERTY) String lastModifiedBy, 060 @JsonProperty(MODIFICATION_DATE_PROPERTY) Long modificationDate) { 061 this.createdBy = createdBy; 062 this.creationDate = creationDate; 063 this.lastModifiedBy = lastModifiedBy; 064 this.modificationDate = modificationDate; 065 } 066 067 public ArchitectureCreationModificationInfo(Long modificationDate, String lastModifiedBy) { 068 this.lastModifiedBy = lastModifiedBy; 069 this.modificationDate = modificationDate; 070 } 071 072 public ArchitectureCreationModificationInfo(String createdBy, Long creationDate) { 073 this.createdBy = createdBy; 074 this.creationDate = creationDate; 075 } 076 077 /** 078 * Creates a new {@link ArchitectureCreationModificationInfo} and initializes 079 * the {@link #createdBy} and {@link #creationDate}. 080 */ 081 public static ArchitectureCreationModificationInfo createCreationInfo(String creator, Long creationDate) { 082 return new ArchitectureCreationModificationInfo(creator, creationDate); 083 } 084 085 /** 086 * Creates a new {@link ArchitectureCreationModificationInfo} and initializes 087 * the {@link #lastModifiedBy} and {@link #modificationDate}. 088 */ 089 public static ArchitectureCreationModificationInfo createModificationInfo(String lastModifiedBy, 090 Long modificationDate) { 091 return new ArchitectureCreationModificationInfo(modificationDate, lastModifiedBy); 092 } 093 094 /** @see #createdBy */ 095 public String getCreatedBy() { 096 return createdBy; 097 } 098 099 /** @see #createdBy */ 100 public void setCreatedBy(String creator) { 101 this.createdBy = creator; 102 } 103 104 /** @see #creationDate */ 105 public Long getCreationDate() { 106 return creationDate; 107 } 108 109 /** @see #creationDate */ 110 public void setCreationDate(Long creationDate) { 111 this.creationDate = creationDate; 112 } 113 114 /** @see #lastModifiedBy */ 115 public String getLastModifiedBy() { 116 return lastModifiedBy; 117 } 118 119 /** @see #lastModifiedBy */ 120 public void setLastModifiedBy(String lastModifiedBy) { 121 this.lastModifiedBy = lastModifiedBy; 122 } 123 124 /** @see #modificationDate */ 125 public Long getModificationDate() { 126 return modificationDate; 127 } 128 129 /** @see #modificationDate */ 130 public void setModificationDate(Long modificationDate) { 131 this.modificationDate = modificationDate; 132 } 133 134 @Override 135 public boolean equals(Object o) { 136 if (this == o) { 137 return true; 138 } 139 if (o == null || getClass() != o.getClass()) { 140 return false; 141 } 142 ArchitectureCreationModificationInfo that = (ArchitectureCreationModificationInfo) o; 143 return Objects.equals(createdBy, that.createdBy) && Objects.equals(creationDate, that.creationDate) 144 && Objects.equals(lastModifiedBy, that.lastModifiedBy) 145 && Objects.equals(modificationDate, that.modificationDate); 146 } 147 148 @Override 149 public int hashCode() { 150 return Objects.hash(createdBy, creationDate, lastModifiedBy, modificationDate); 151 } 152}