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;
27 * @author Olivier Lamy
30 @XmlRootElement(name = "repositoryGroup")
31 public class RepositoryGroup
32 implements Serializable
42 private List<String> repositories;
45 * The path of the merged index.
47 private String mergedIndexPath = "/.indexer";
50 * The TTL (time to live) of the repo group's merged index.
52 private int mergedIndexTtl = 30;
55 * default model value is empty so none
58 private String cronExpression;
60 public RepositoryGroup()
65 public RepositoryGroup( String id, List<String> repositories )
68 this.repositories = repositories;
72 * Method addRepository.
76 public void addRepository( String string )
78 getRepositories().add( string );
82 * Get the id of the repository group.
92 * Method getRepositories.
96 public List<String> getRepositories()
98 if ( this.repositories == null )
100 this.repositories = new ArrayList<>( 0 );
103 return this.repositories;
107 * Method removeRepository.
111 public void removeRepository( String string )
113 getRepositories().remove( string );
117 * Set the id of the repository group.
121 public void setId( String id )
127 * Set the list of repository ids under the group.
129 * @param repositories
131 public void setRepositories( List<String> repositories )
133 this.repositories = repositories;
136 public String getMergedIndexPath()
138 return mergedIndexPath;
141 public void setMergedIndexPath( String mergedIndexPath )
143 this.mergedIndexPath = mergedIndexPath;
146 public int getMergedIndexTtl() {
147 return mergedIndexTtl;
151 * Set the TTL of the repo group's merged index.
153 * @param mergedIndexTtl
155 public void setMergedIndexTtl(int mergedIndexTtl) {
156 this.mergedIndexTtl = mergedIndexTtl;
159 public RepositoryGroup mergedIndexPath( String mergedIndexPath ) {
160 this.mergedIndexPath = mergedIndexPath;
164 public RepositoryGroup mergedIndexTtl( int mergedIndexTtl ) {
165 this.mergedIndexTtl = mergedIndexTtl;
169 public String getCronExpression()
171 return cronExpression;
174 public void setCronExpression( String cronExpression )
176 this.cronExpression = cronExpression;
179 public RepositoryGroup cronExpression( String mergedIndexCronExpression )
181 this.cronExpression = mergedIndexCronExpression;
186 public boolean equals( Object other )
193 if ( !( other instanceof RepositoryGroup ) )
198 RepositoryGroup that = (RepositoryGroup) other;
199 boolean result = true;
200 result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
205 public int hashCode()
208 result = 37 * result + ( id != null ? id.hashCode() : 0 );
213 public String toString()
215 final StringBuilder sb = new StringBuilder( "RepositoryGroup{" );
216 sb.append( "id='" ).append( id ).append( '\'' );
217 sb.append( ", repositories=" ).append( repositories );
218 sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
219 sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl );
220 sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
222 return sb.toString();