001package org.apache.maven.scm.command.add;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.ArrayList;
023import java.util.List;
024
025import org.apache.maven.scm.ScmFile;
026import org.apache.maven.scm.ScmResult;
027
028/**
029 * Result of adding files to the SCM
030 *
031 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
032 *
033 */
034public class AddScmResult
035    extends ScmResult
036{
037    private static final long serialVersionUID = 1L;
038    
039    private List<ScmFile> addedFiles;
040
041    public AddScmResult( String commandLine, String providerMessage, String commandOutput, boolean success )
042    {
043        super( commandLine, providerMessage, commandOutput, success );
044
045        addedFiles = new ArrayList<ScmFile>( 0 );
046    }
047
048    public AddScmResult( String commandLine, List<ScmFile> addedFiles )
049    {
050        this( commandLine, null, null, true );
051
052        if ( addedFiles == null )
053        {
054            throw new NullPointerException( "addedFiles can't be null" );
055        }
056
057        this.addedFiles = addedFiles;
058    }
059
060    public AddScmResult( List<ScmFile> addedFiles, ScmResult result )
061    {
062        super( result );
063
064        if ( addedFiles == null )
065        {
066            throw new NullPointerException( "addedFiles can't be null" );
067        }
068
069        this.addedFiles = addedFiles;
070    }
071
072    /**
073     * List with all the added files in the SCM operation.
074     *
075     * @return non null list of added files
076     */
077    public List<ScmFile> getAddedFiles()
078    {
079        return addedFiles;
080    }
081}