package org.apache.archiva.scheduler.repository;

import java.io.File;

import org.codehaus.plexus.taskqueue.Task;

/*
 * 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.
 */

/**
 * DataRefreshTask - task for discovering changes in the repository 
 * and updating all associated data. 
 *
 * @version $Id: DataRefreshTask.java 525176 2007-04-03 15:21:33Z joakime $
 */
public class RepositoryTask
    implements Task
{
    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() );
        result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() );
        return result;
    }

    @Override
    public boolean equals( Object obj )
    {
        if ( this == obj )
            return true;
        if ( obj == null )
            return false;
        if ( getClass() != obj.getClass() )
            return false;
        RepositoryTask other = (RepositoryTask) obj;
        if ( repositoryId == null )
        {
            if ( other.repositoryId != null )
                return false;
        }
        else if ( !repositoryId.equals( other.repositoryId ) )
            return false;
        if ( resourceFile == null )
        {
            if ( other.resourceFile != null )
                return false;
        }
        else if ( !resourceFile.equals( other.resourceFile ) )
            return false;
        return true;
    }

    private String repositoryId;
    
    private File resourceFile;
    
    private boolean updateRelatedArtifacts;
    
    private boolean scanAll;
    
    public boolean isScanAll()
    {
        return scanAll;
    }

    public void setScanAll( boolean scanAll )
    {
        this.scanAll = scanAll;
    }

    public String getRepositoryId()
    {
        return repositoryId;
    }

    public void setRepositoryId( String repositoryId )
    {
        this.repositoryId = repositoryId;
    }

    public long getMaxExecutionTime()
    {
        return 0;
    }

    public File getResourceFile()
    {
        return resourceFile;
    }

    public void setResourceFile( File resourceFile )
    {
        this.resourceFile = resourceFile;
    }

    public boolean isUpdateRelatedArtifacts()
    {
        return updateRelatedArtifacts;
    }

    public void setUpdateRelatedArtifacts( boolean updateRelatedArtifacts )
    {
        this.updateRelatedArtifacts = updateRelatedArtifacts;
    }

    @Override
    public String toString()
    {
        return "RepositoryTask [repositoryId=" + repositoryId + ", resourceFile=" + resourceFile + ", scanAll="
            + scanAll + ", updateRelatedArtifacts=" + updateRelatedArtifacts + "]";
    }
}

@@ -47,30 +47,8 @@
 y;%0A%0A
-import java.io.File;%0A%0A
 impo
@@ -87,16 +87,38 @@
 .Task;%0A%0A
+import java.io.File;%0A%0A
 /*%0A * Li
@@ -989,17 +989,16 @@
 pository
- 
 %0A * and 
@@ -1026,17 +1026,16 @@
 ed data.
- 
 %0A *%0A * @
@@ -1164,1084 +1164,8 @@
 k%0A%7B%0A
-    @Override%0A    public int hashCode()%0A    %7B%0A        final int prime = 31;%0A        int result = 1;%0A        result = prime * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() );%0A        result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() );%0A        return result;%0A    %7D%0A%0A    @Override%0A    public boolean equals( Object obj )%0A    %7B%0A        if ( this == obj )%0A            return true;%0A        if ( obj == null )%0A            return false;%0A        if ( getClass() != obj.getClass() )%0A            return false;%0A        RepositoryTask other = (RepositoryTask) obj;%0A        if ( repositoryId == null )%0A        %7B%0A            if ( other.repositoryId != null )%0A                return false;%0A        %7D%0A        else if ( !repositoryId.equals( other.repositoryId ) )%0A            return false;%0A        if ( resourceFile == null )%0A        %7B%0A            if ( other.resourceFile != null )%0A                return false;%0A        %7D%0A        else if ( !resourceFile.equals( other.resourceFile ) )%0A            return false;%0A        return true;%0A    %7D%0A%0A
     
@@ -1193,20 +1193,16 @@
 toryId;%0A
-    
 %0A    pri
@@ -1225,20 +1225,16 @@
 ceFile;%0A
-    
 %0A    pri
@@ -1270,20 +1270,16 @@
 ifacts;%0A
-    
 %0A    pri
@@ -1300,20 +1300,16 @@
 canAll;%0A
-    
 %0A    pub
@@ -2400,11 +2400,1243 @@
 %22;%0A    %7D
+%0A%0A    @Override%0A    public int hashCode()%0A    %7B%0A        final int prime = 31;%0A        int result = 1;%0A        result = prime * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() );%0A        result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() );%0A        return result;%0A    %7D%0A%0A    @Override%0A    public boolean equals( Object obj )%0A    %7B%0A        if ( this == obj )%0A        %7B%0A            return true;%0A        %7D%0A        if ( obj == null )%0A        %7B%0A            return false;%0A        %7D%0A        if ( getClass() != obj.getClass() )%0A        %7B%0A            return false;%0A        %7D%0A        RepositoryTask other = (RepositoryTask) obj;%0A        if ( repositoryId == null )%0A        %7B%0A            if ( other.repositoryId != null )%0A            %7B%0A                return false;%0A            %7D%0A        %7D%0A        else if ( !repositoryId.equals( other.repositoryId ) )%0A        %7B%0A            return false;%0A        %7D%0A        if ( resourceFile == null )%0A        %7B%0A            if ( other.resourceFile != null )%0A            %7B%0A                return false;%0A            %7D%0A        %7D%0A        else if ( !resourceFile.equals( other.resourceFile ) )%0A        %7B%0A            return false;%0A        %7D%0A        return true;%0A    %7D
 %0A%7D%0A

format code