org.apache.maven.archiva.model.ArchivaRepositoryMetadata Maven / Gradle / Ivy
/*
* $Id$
*/
package org.apache.maven.archiva.model;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import java.util.Date;
/**
* null
*
* @version $Revision$ $Date$
*/
public class ArchivaRepositoryMetadata implements java.io.Serializable {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field groupId
*/
private String groupId;
/**
* Field artifactId
*/
private String artifactId;
/**
* Field version
*/
private String version;
/**
* Field latestVersion
*/
private String latestVersion;
/**
* Field releasedVersion
*/
private String releasedVersion;
/**
* Field snapshotVersion
*/
private SnapshotVersion snapshotVersion;
/**
* Field availableVersions
*/
private java.util.List availableVersions;
/**
* Field lastUpdated
*/
private String lastUpdated;
/**
* Field fileLastModified
*/
private java.util.Date fileLastModified;
/**
* Field fileSize
*/
private long fileSize = 0;
/**
* Field whenIndexed
*/
private java.util.Date whenIndexed;
/**
* Field origin
*/
private String origin;
//-----------/
//- Methods -/
//-----------/
/**
* Method addAvailableVersion
*
* @param string
*/
public void addAvailableVersion(String string)
{
if ( !(string instanceof String) )
{
throw new ClassCastException( "ArchivaRepositoryMetadata.addAvailableVersions(string) parameter must be instanceof " + String.class.getName() );
}
getAvailableVersions().add( string );
} //-- void addAvailableVersion(String)
/**
* Method equals
*
* @param other
*/
public boolean equals(Object other)
{
if ( this == other)
{
return true;
}
if ( !(other instanceof ArchivaRepositoryMetadata) )
{
return false;
}
ArchivaRepositoryMetadata that = (ArchivaRepositoryMetadata) other;
boolean result = true;
result = result && ( getGroupId() == null ? that.getGroupId() == null : getGroupId().equals( that.getGroupId() ) );
result = result && ( getArtifactId() == null ? that.getArtifactId() == null : getArtifactId().equals( that.getArtifactId() ) );
result = result && ( getVersion() == null ? that.getVersion() == null : getVersion().equals( that.getVersion() ) );
return result;
} //-- boolean equals(Object)
/**
* Get
* The Artifact ID of the metadata.
*
*/
public String getArtifactId()
{
return this.artifactId;
} //-- String getArtifactId()
/**
* Method getAvailableVersions
*/
public java.util.List getAvailableVersions()
{
if ( this.availableVersions == null )
{
this.availableVersions = new java.util.ArrayList();
}
return this.availableVersions;
} //-- java.util.List getAvailableVersions()
/**
* Get
* The Last Modified Timestamp of this file.
*
*/
public java.util.Date getFileLastModified()
{
return this.fileLastModified;
} //-- java.util.Date getFileLastModified()
/**
* Get
* The size of the artifact on disk.
*
*/
public long getFileSize()
{
return this.fileSize;
} //-- long getFileSize()
/**
* Get
* The Group ID of the metadata.
*
*/
public String getGroupId()
{
return this.groupId;
} //-- String getGroupId()
/**
* Get
* When the metadata was last updated.
*
*/
public String getLastUpdated()
{
return this.lastUpdated;
} //-- String getLastUpdated()
/**
* Get
* The latest version id.
*
*/
public String getLatestVersion()
{
return this.latestVersion;
} //-- String getLatestVersion()
/**
* Get
* The origin of this artifact. (Filesystem, Proxy,
* Deploy)
*
*/
public String getOrigin()
{
return this.origin;
} //-- String getOrigin()
/**
* Get
* The released version id.
*
*/
public String getReleasedVersion()
{
return this.releasedVersion;
} //-- String getReleasedVersion()
/**
* Get
* The snapshot version id.
*
*/
public SnapshotVersion getSnapshotVersion()
{
return this.snapshotVersion;
} //-- SnapshotVersion getSnapshotVersion()
/**
* Get
* The Version of the metadata.
*
*/
public String getVersion()
{
return this.version;
} //-- String getVersion()
/**
* Get
* The timestamp when this artifact was indexed.
*
*/
public java.util.Date getWhenIndexed()
{
return this.whenIndexed;
} //-- java.util.Date getWhenIndexed()
/**
* Method hashCode
*/
public int hashCode()
{
int result = 17;
long tmp;
result = 37 * result + ( groupId != null ? groupId.hashCode() : 0 );
result = 37 * result + ( artifactId != null ? artifactId.hashCode() : 0 );
result = 37 * result + ( version != null ? version.hashCode() : 0 );
return result;
} //-- int hashCode()
/**
* Method removeAvailableVersion
*
* @param string
*/
public void removeAvailableVersion(String string)
{
if ( !(string instanceof String) )
{
throw new ClassCastException( "ArchivaRepositoryMetadata.removeAvailableVersions(string) parameter must be instanceof " + String.class.getName() );
}
getAvailableVersions().remove( string );
} //-- void removeAvailableVersion(String)
/**
* Set
* The Artifact ID of the metadata.
*
*
* @param artifactId
*/
public void setArtifactId(String artifactId)
{
this.artifactId = artifactId;
} //-- void setArtifactId(String)
/**
* Set
* The list of available version ids.
*
*
* @param availableVersions
*/
public void setAvailableVersions(java.util.List availableVersions)
{
this.availableVersions = availableVersions;
} //-- void setAvailableVersions(java.util.List)
/**
* Set
* The Last Modified Timestamp of this file.
*
*
* @param fileLastModified
*/
public void setFileLastModified(java.util.Date fileLastModified)
{
this.fileLastModified = fileLastModified;
} //-- void setFileLastModified(java.util.Date)
/**
* Set
* The size of the artifact on disk.
*
*
* @param fileSize
*/
public void setFileSize(long fileSize)
{
this.fileSize = fileSize;
} //-- void setFileSize(long)
/**
* Set
* The Group ID of the metadata.
*
*
* @param groupId
*/
public void setGroupId(String groupId)
{
this.groupId = groupId;
} //-- void setGroupId(String)
/**
* Set
* When the metadata was last updated.
*
*
* @param lastUpdated
*/
public void setLastUpdated(String lastUpdated)
{
this.lastUpdated = lastUpdated;
} //-- void setLastUpdated(String)
/**
* Set
* The latest version id.
*
*
* @param latestVersion
*/
public void setLatestVersion(String latestVersion)
{
this.latestVersion = latestVersion;
} //-- void setLatestVersion(String)
/**
* Set
* The origin of this artifact. (Filesystem, Proxy,
* Deploy)
*
*
* @param origin
*/
public void setOrigin(String origin)
{
this.origin = origin;
} //-- void setOrigin(String)
/**
* Set
* The released version id.
*
*
* @param releasedVersion
*/
public void setReleasedVersion(String releasedVersion)
{
this.releasedVersion = releasedVersion;
} //-- void setReleasedVersion(String)
/**
* Set
* The snapshot version id.
*
*
* @param snapshotVersion
*/
public void setSnapshotVersion(SnapshotVersion snapshotVersion)
{
this.snapshotVersion = snapshotVersion;
} //-- void setSnapshotVersion(SnapshotVersion)
/**
* Set
* The Version of the metadata.
*
*
* @param version
*/
public void setVersion(String version)
{
this.version = version;
} //-- void setVersion(String)
/**
* Set
* The timestamp when this artifact was indexed.
*
*
* @param whenIndexed
*/
public void setWhenIndexed(java.util.Date whenIndexed)
{
this.whenIndexed = whenIndexed;
} //-- void setWhenIndexed(java.util.Date)
/**
* Method toString
*/
public java.lang.String toString()
{
StringBuffer buf = new StringBuffer();
buf.append( "groupId = '" );
buf.append( getGroupId() + "'" );
buf.append( "\n" );
buf.append( "artifactId = '" );
buf.append( getArtifactId() + "'" );
buf.append( "\n" );
buf.append( "version = '" );
buf.append( getVersion() + "'" );
return buf.toString();
} //-- java.lang.String toString()
private static final long serialVersionUID = 914715358219606100L;
public void updateTimestamp()
{
setLastUpdatedTimestamp( new java.util.Date() );
}
public void setLastUpdatedTimestamp( java.util.Date date )
{
java.util.TimeZone timezone = java.util.TimeZone.getTimeZone( "UTC" );
java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
fmt.setTimeZone( timezone );
setLastUpdated( fmt.format( date ) );
}
private String modelEncoding = "UTF-8";
public void setModelEncoding( String modelEncoding )
{
this.modelEncoding = modelEncoding;
}
public String getModelEncoding()
{
return modelEncoding;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy