1 package org.apache.archiva.admin.model.beans;
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 javax.xml.bind.annotation.XmlRootElement;
22 import java.io.Serializable;
23 import java.util.ArrayList;
24 import java.util.List;
26 import static org.apache.archiva.indexer.ArchivaIndexManager.DEFAULT_INDEX_PATH;
29 * @author Olivier Lamy
32 @XmlRootElement(name = "repositoryGroup")
33 public class RepositoryGroup
34 implements Serializable
44 private List<String> repositories;
47 * The path of the merged index.
49 private String mergedIndexPath = DEFAULT_INDEX_PATH;
52 * The TTL (time to live) of the repo group's merged index.
54 private int mergedIndexTtl = -1;
57 * default model value is empty so none
60 private String cronExpression;
62 private String location;
64 public RepositoryGroup()
69 public RepositoryGroup( String id, List<String> repositories )
72 this.repositories = repositories;
76 * Method addRepository.
80 public void addRepository( String string )
82 getRepositories().add( string );
86 * Get the id of the repository group.
96 * Method getRepositories.
100 public List<String> getRepositories()
102 if ( this.repositories == null )
104 this.repositories = new ArrayList<>( 0 );
107 return this.repositories;
111 * Method removeRepository.
115 public void removeRepository( String string )
117 getRepositories().remove( string );
121 * Set the id of the repository group.
125 public void setId( String id )
131 * Set the list of repository ids under the group.
133 * @param repositories
135 public void setRepositories( List<String> repositories )
137 this.repositories = repositories;
140 public String getMergedIndexPath()
142 return mergedIndexPath;
145 public void setMergedIndexPath( String mergedIndexPath )
147 this.mergedIndexPath = mergedIndexPath;
150 public int getMergedIndexTtl() {
151 return mergedIndexTtl;
155 * Set the TTL of the repo group's merged index.
157 * @param mergedIndexTtl
159 public void setMergedIndexTtl(int mergedIndexTtl) {
160 this.mergedIndexTtl = mergedIndexTtl;
163 public RepositoryGroup mergedIndexPath( String mergedIndexPath ) {
164 this.mergedIndexPath = mergedIndexPath;
168 public RepositoryGroup mergedIndexTtl( int mergedIndexTtl ) {
169 this.mergedIndexTtl = mergedIndexTtl;
173 public String getCronExpression()
175 return cronExpression;
178 public void setCronExpression( String cronExpression )
180 this.cronExpression = cronExpression;
183 public RepositoryGroup cronExpression( String mergedIndexCronExpression )
185 this.cronExpression = mergedIndexCronExpression;
189 public String getLocation( )
194 public void setLocation( String location )
196 this.location = location;
200 public boolean equals( Object other )
207 if ( !( other instanceof RepositoryGroup ) )
212 RepositoryGroup that = (RepositoryGroup) other;
213 boolean result = true;
214 result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
219 public int hashCode()
222 result = 37 * result + ( id != null ? id.hashCode() : 0 );
227 public String toString()
229 final StringBuilder sb = new StringBuilder( "RepositoryGroup{" );
230 sb.append( "id='" ).append( id ).append( '\'' );
231 sb.append( ", repositories=" ).append( repositories );
232 sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
233 sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl );
234 sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
236 return sb.toString();