[MRM-1520] remove duplicate beans : fix for ArchivaAdministration service

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-15 19:53:24 +00:00
parent de35618128
commit 0396658ae6
6 changed files with 9 additions and 349 deletions

View File

@ -1,127 +0,0 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @author Olivier Lamy
* @since 1.4
*/
@XmlRootElement( name = "fileType" )
public class FileType
implements Serializable
{
/**
* Field id.
*/
private String id;
/**
* Field patterns.
*/
private List<String> patterns;
public FileType()
{
// no op
}
public FileType( String id, List<String> patterns )
{
this.id = id;
this.patterns = patterns;
}
public String getId()
{
return id;
}
public void setId( String id )
{
this.id = id;
}
public List<String> getPatterns()
{
if ( patterns == null )
{
this.patterns = new ArrayList<String>();
}
return patterns;
}
public void setPatterns( List<String> patterns )
{
this.patterns = patterns;
}
public void addPattern( String pattern )
{
getPatterns().add( pattern );
}
public void removePattern( String pattern )
{
getPatterns().remove( pattern );
}
@Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null || getClass() != o.getClass() )
{
return false;
}
FileType fileType = (FileType) o;
if ( id != null ? !id.equals( fileType.id ) : fileType.id != null )
{
return false;
}
return true;
}
@Override
public int hashCode()
{
return id != null ? 37 + id.hashCode() : 0;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append( "FileType" );
sb.append( "{id='" ).append( id ).append( '\'' );
sb.append( ", patterns=" ).append( patterns );
sb.append( '}' );
return sb.toString();
}
}

View File

@ -1,115 +0,0 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
/**
* @author Olivier Lamy
* @since 1.4
*/
@XmlRootElement( name = "legacyArtifactPath" )
public class LegacyArtifactPath
implements Serializable
{
/**
* The legacy path.
*/
private String path;
/**
* The artifact reference, as " [groupId] :
* [artifactId] : [version] : [classifier] : [type] ".
*/
private String artifact;
public LegacyArtifactPath()
{
// no op
}
public LegacyArtifactPath( String path, String artifact )
{
this.path = path;
this.artifact = artifact;
}
public String getPath()
{
return path;
}
public void setPath( String path )
{
this.path = path;
}
public String getArtifact()
{
return artifact;
}
public void setArtifact( String artifact )
{
this.artifact = artifact;
}
public boolean match( String path )
{
return path.equals( this.path );
}
public String getGroupId()
{
return artifact.split( ":" )[0];
}
public String getArtifactId()
{
return artifact.split( ":" )[1];
}
public String getVersion()
{
return artifact.split( ":" )[2];
}
public String getClassifier()
{
String classifier = artifact.split( ":" )[3];
return classifier.length() > 0 ? classifier : null;
}
public String getType()
{
return artifact.split( ":" )[4];
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append( "LegacyArtifactPath" );
sb.append( "{path='" ).append( path ).append( '\'' );
sb.append( ", artifact='" ).append( artifact ).append( '\'' );
sb.append( '}' );
return sb.toString();
}
}

View File

@ -1,98 +0,0 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Olivier Lamy
* @since 1.4
*/
@XmlRootElement( name = "organisationInformation" )
public class OrganisationInformation
{
/**
* name of the organisation.
*/
private String name;
/**
* name of the organisation.
*/
private String url;
/**
* name of the organisation.
*/
private String logoLocation;
public OrganisationInformation()
{
// no op
}
public OrganisationInformation( String name, String url, String logoLocation )
{
this.name = name;
this.url = url;
this.logoLocation = logoLocation;
}
public String getName()
{
return name;
}
public void setName( String name )
{
this.name = name;
}
public String getUrl()
{
return url;
}
public void setUrl( String url )
{
this.url = url;
}
public String getLogoLocation()
{
return logoLocation;
}
public void setLogoLocation( String logoLocation )
{
this.logoLocation = logoLocation;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append( "OrganisationInformation" );
sb.append( "{name='" ).append( name ).append( '\'' );
sb.append( ", url='" ).append( url ).append( '\'' );
sb.append( ", logoLocation='" ).append( logoLocation ).append( '\'' );
sb.append( '}' );
return sb.toString();
}
}

View File

@ -18,9 +18,9 @@ package org.apache.archiva.rest.api.services;
* under the License.
*/
import org.apache.archiva.rest.api.model.FileType;
import org.apache.archiva.rest.api.model.LegacyArtifactPath;
import org.apache.archiva.rest.api.model.OrganisationInformation;
import org.apache.archiva.admin.model.beans.FileType;
import org.apache.archiva.admin.model.beans.LegacyArtifactPath;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;

View File

@ -21,9 +21,9 @@ package org.apache.archiva.rest.services;
import net.sf.beanlib.provider.replicator.BeanReplicator;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.rest.api.model.FileType;
import org.apache.archiva.rest.api.model.LegacyArtifactPath;
import org.apache.archiva.rest.api.model.OrganisationInformation;
import org.apache.archiva.admin.model.beans.FileType;
import org.apache.archiva.admin.model.beans.LegacyArtifactPath;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.springframework.stereotype.Service;

View File

@ -18,9 +18,9 @@ package org.apache.archiva.rest.services;
* under the License.
*/
import org.apache.archiva.rest.api.model.FileType;
import org.apache.archiva.rest.api.model.LegacyArtifactPath;
import org.apache.archiva.rest.api.model.OrganisationInformation;
import org.apache.archiva.admin.model.beans.FileType;
import org.apache.archiva.admin.model.beans.LegacyArtifactPath;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;