View Javadoc

1   /*
2    * Copyright 2006-2012 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.maven.plugin.buildmetadata.scm;
17  
18  /**
19   * Stores the information about locally modified files.
20   *
21   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
22   * @version $Revision:591 $
23   */
24  public final class LocallyModifiedInfo
25  {
26    // ********************************* Fields *********************************
27  
28    // --- constants ------------------------------------------------------------
29  
30    // --- members --------------------------------------------------------------
31  
32    /**
33     * The flag that shows whether the files are modified (<code>true</code>) or
34     * not (<code>false</code>).
35     */
36    private final boolean locallyModified;
37  
38    /**
39     * The list of files that where reported to be modified. This includes all
40     * files that are not in-sync with the trunk of the repository.
41     */
42    private final String files;
43  
44    // ****************************** Initializer *******************************
45  
46    // ****************************** Constructors ******************************
47  
48    /**
49     * Default constructor.
50     *
51     * @param locallyModified the flag that shows whether the files are modified (
52     *          <code>true</code>) or not (<code>false</code>).
53     * @param files the list of files that where reported to be modified.
54     */
55    public LocallyModifiedInfo(final boolean locallyModified, final String files)
56    {
57      this.locallyModified = locallyModified;
58      this.files = normalize(files);
59    }
60  
61    // ****************************** Inner Classes *****************************
62  
63    // ********************************* Methods ********************************
64  
65    // --- init -----------------------------------------------------------------
66  
67    private String normalize(final String files)
68    {
69      if (files == null)
70      {
71        return null;
72      }
73      return files.replace('\\', '/');
74    }
75  
76    // --- get&set --------------------------------------------------------------
77  
78    /**
79     * Returns the flag that shows whether the files are modified (
80     * <code>true</code>) or not (<code>false</code>).
81     *
82     * @return the flag that shows whether the files are modified (
83     *         <code>true</code>) or not (<code>false</code>).
84     */
85    public boolean isLocallyModified()
86    {
87      return locallyModified;
88    }
89  
90    /**
91     * Returns the list of files that where reported to be modified. This includes
92     * all files that are not in-sync with the trunk of the repository.
93     *
94     * @return the list of files that where reported to be modified.
95     */
96    public String getFiles()
97    {
98      return files;
99    }
100 
101   // --- business -------------------------------------------------------------
102 
103   // --- object basics --------------------------------------------------------
104 
105 }