123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- package org.apache.archiva.admin.model.beans;
- /*
- * 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-M1
- */
- @XmlRootElement(name = "repositoryGroup")
- public class RepositoryGroup
- implements Serializable
- {
- /**
- * repository group Id
- */
- private String id;
-
- /**
- * repositories ids
- */
- private List<String> repositories;
-
- /**
- * The path of the merged index.
- */
- private String mergedIndexPath = "/.indexer";
-
- /**
- * The TTL (time to live) of the repo group's merged index.
- */
- private int mergedIndexTtl = 30;
-
- /**
- * default model value is empty so none
- * @since 2.0.0
- */
- private String cronExpression;
-
- public RepositoryGroup()
- {
- // no op
- }
-
- public RepositoryGroup( String id, List<String> repositories )
- {
- this.id = id;
- this.repositories = repositories;
- }
-
- /**
- * Method addRepository.
- *
- * @param string
- */
- public void addRepository( String string )
- {
- getRepositories().add( string );
- }
-
- /**
- * Get the id of the repository group.
- *
- * @return String
- */
- public String getId()
- {
- return this.id;
- }
-
- /**
- * Method getRepositories.
- *
- * @return List
- */
- public List<String> getRepositories()
- {
- if ( this.repositories == null )
- {
- this.repositories = new ArrayList<>( 0 );
- }
-
- return this.repositories;
- }
-
- /**
- * Method removeRepository.
- *
- * @param string
- */
- public void removeRepository( String string )
- {
- getRepositories().remove( string );
- }
-
- /**
- * Set the id of the repository group.
- *
- * @param id
- */
- public void setId( String id )
- {
- this.id = id;
- }
-
- /**
- * Set the list of repository ids under the group.
- *
- * @param repositories
- */
- public void setRepositories( List<String> repositories )
- {
- this.repositories = repositories;
- }
-
- public String getMergedIndexPath()
- {
- return mergedIndexPath;
- }
-
- public void setMergedIndexPath( String mergedIndexPath )
- {
- this.mergedIndexPath = mergedIndexPath;
- }
-
- public int getMergedIndexTtl() {
- return mergedIndexTtl;
- }
-
- /**
- * Set the TTL of the repo group's merged index.
- *
- * @param mergedIndexTtl
- */
- public void setMergedIndexTtl(int mergedIndexTtl) {
- this.mergedIndexTtl = mergedIndexTtl;
- }
-
- public RepositoryGroup mergedIndexPath( String mergedIndexPath ) {
- this.mergedIndexPath = mergedIndexPath;
- return this;
- }
-
- public RepositoryGroup mergedIndexTtl( int mergedIndexTtl ) {
- this.mergedIndexTtl = mergedIndexTtl;
- return this;
- }
-
- public String getCronExpression()
- {
- return cronExpression;
- }
-
- public void setCronExpression( String cronExpression )
- {
- this.cronExpression = cronExpression;
- }
-
- public RepositoryGroup cronExpression( String mergedIndexCronExpression )
- {
- this.cronExpression = mergedIndexCronExpression;
- return this;
- }
-
- public boolean equals( Object other )
- {
- if ( this == other )
- {
- return true;
- }
-
- if ( !( other instanceof RepositoryGroup ) )
- {
- return false;
- }
-
- RepositoryGroup that = (RepositoryGroup) other;
- boolean result = true;
- result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
- return result;
- }
-
- public int hashCode()
- {
- int result = 17;
- result = 37 * result + ( id != null ? id.hashCode() : 0 );
- return result;
- }
-
- @Override
- public String toString()
- {
- final StringBuilder sb = new StringBuilder( "RepositoryGroup{" );
- sb.append( "id='" ).append( id ).append( '\'' );
- sb.append( ", repositories=" ).append( repositories );
- sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
- sb.append( ", mergedIndexTtl=" ).append( mergedIndexTtl );
- sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
- sb.append( '}' );
- return sb.toString();
- }
- }
|