001package org.apache.archiva.web.model; 002/* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020 021import javax.xml.bind.annotation.XmlRootElement; 022import java.io.Serializable; 023 024/** 025 * @author Olivier Lamy 026 * @since 1.4-M3 027 */ 028@XmlRootElement( name = "fileMetadata" ) 029public class FileMetadata 030 implements Serializable 031{ 032 private String name; 033 034 private String serverFileName; 035 036 private long size; 037 038 private String url; 039 040 private String deleteUrl; 041 042 private String deleteType; 043 044 private String errorKey; 045 046 private String classifier; 047 048 private String packaging; 049 050 private boolean pomFile; 051 052 public FileMetadata() 053 { 054 // no op 055 } 056 057 public FileMetadata( String serverFileName ) 058 { 059 this.serverFileName = serverFileName; 060 } 061 062 public FileMetadata( String name, long size, String url ) 063 { 064 this.name = name; 065 this.size = size; 066 this.url = url; 067 this.deleteUrl = url; 068 this.deleteType = "DELETE"; 069 } 070 071 public String getName() 072 { 073 return name; 074 } 075 076 public void setName( String name ) 077 { 078 this.name = name; 079 } 080 081 public long getSize() 082 { 083 return size; 084 } 085 086 public void setSize( long size ) 087 { 088 this.size = size; 089 } 090 091 public String getUrl() 092 { 093 return url; 094 } 095 096 public void setUrl( String url ) 097 { 098 this.url = url; 099 } 100 101 public String getDeleteUrl() 102 { 103 return deleteUrl; 104 } 105 106 public void setDeleteUrl( String deleteUrl ) 107 { 108 this.deleteUrl = deleteUrl; 109 } 110 111 public String getDeleteType() 112 { 113 return deleteType; 114 } 115 116 public void setDeleteType( String deleteType ) 117 { 118 this.deleteType = deleteType; 119 } 120 121 public String getErrorKey() 122 { 123 return errorKey; 124 } 125 126 public void setErrorKey( String errorKey ) 127 { 128 this.errorKey = errorKey; 129 } 130 131 public String getClassifier() 132 { 133 return classifier; 134 } 135 136 public void setClassifier( String classifier ) 137 { 138 this.classifier = classifier; 139 } 140 141 142 public boolean isPomFile() 143 { 144 return pomFile; 145 } 146 147 public void setPomFile( boolean pomFile ) 148 { 149 this.pomFile = pomFile; 150 } 151 152 public String getServerFileName() 153 { 154 return serverFileName; 155 } 156 157 public void setServerFileName( String serverFileName ) 158 { 159 this.serverFileName = serverFileName; 160 } 161 162 public String getPackaging() 163 { 164 return packaging; 165 } 166 167 public void setPackaging( String packaging ) 168 { 169 this.packaging = packaging; 170 } 171 172 @Override 173 public boolean equals( Object o ) 174 { 175 if ( this == o ) 176 { 177 return true; 178 } 179 if ( !( o instanceof FileMetadata ) ) 180 { 181 return false; 182 } 183 184 FileMetadata that = (FileMetadata) o; 185 186 if ( !serverFileName.equals( that.serverFileName ) ) 187 { 188 return false; 189 } 190 191 return true; 192 } 193 194 @Override 195 public int hashCode() 196 { 197 return serverFileName.hashCode(); 198 } 199 200 @Override 201 public String toString() 202 { 203 final StringBuilder sb = new StringBuilder( "FileMetadata{" ); 204 sb.append( "name='" ).append( name ).append( '\'' ); 205 sb.append( ", serverFileName='" ).append( serverFileName ).append( '\'' ); 206 sb.append( ", size=" ).append( size ); 207 sb.append( ", url='" ).append( url ).append( '\'' ); 208 sb.append( ", deleteUrl='" ).append( deleteUrl ).append( '\'' ); 209 sb.append( ", deleteType='" ).append( deleteType ).append( '\'' ); 210 sb.append( ", errorKey='" ).append( errorKey ).append( '\'' ); 211 sb.append( ", classifier='" ).append( classifier ).append( '\'' ); 212 sb.append( ", packaging='" ).append( packaging ).append( '\'' ); 213 sb.append( ", pomFile=" ).append( pomFile ); 214 sb.append( '}' ); 215 return sb.toString(); 216 } 217}