1 package org.apache.archiva.admin.repository.group;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import java.io.Serializable;
22 import java.util.ArrayList;
23 import java.util.List;
26 * @author Olivier Lamy
29 public class RepositoryGroup
30 implements Serializable
40 private List<String> repositories;
42 public RepositoryGroup()
47 public RepositoryGroup( String id, List<String> repositories )
50 this.repositories = repositories;
54 * Method addRepository.
58 public void addRepository( String string )
60 getRepositories().add( string );
64 * Get the id of the repository group.
74 * Method getRepositories.
78 public java.util.List<String> getRepositories()
80 if ( this.repositories == null )
82 this.repositories = new ArrayList<String>();
85 return this.repositories;
89 * Method removeRepository.
93 public void removeRepository( String string )
95 getRepositories().remove( string );
99 * Set the id of the repository group.
103 public void setId( String id )
109 * Set the list of repository ids under the group.
111 * @param repositories
113 public void setRepositories( List<String> repositories )
115 this.repositories = repositories;
118 public boolean equals( Object other )
125 if ( !( other instanceof RepositoryGroup ) )
130 RepositoryGroup that = (RepositoryGroup) other;
131 boolean result = true;
132 result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
136 public int hashCode()
139 result = 37 * result + ( id != null ? id.hashCode() : 0 );
144 public String toString()
146 final StringBuilder sb = new StringBuilder();
147 sb.append( "RepositoryGroup" );
148 sb.append( "{id='" ).append( id ).append( '\'' );
149 sb.append( ", repositories=" ).append( repositories );
151 return sb.toString();