KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > cvsclient > file > FileStatus


1 /*****************************************************************************
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is the CVS Client Library.
16  * The Initial Developer of the Original Software is Robert Greig.
17  * Portions created by Robert Greig are Copyright (C) 2000.
18  * All Rights Reserved.
19  *
20  * Contributor(s): Robert Greig.
21  *****************************************************************************/

22 package org.netbeans.lib.cvsclient.file;
23
24 /**
25  * This class provides constants for file statuses.
26  * @author Robert Greig
27  */

28 public class FileStatus {
29     /**
30      * Returns the corresponding FileStatus constant for the specified String.
31      */

32     public static FileStatus getStatusForString(String JavaDoc statusString) {
33         if (statusString == null) {
34             return null;
35         }
36
37         if (statusString.equals(ADDED.toString())) {
38             return ADDED;
39         }
40         if (statusString.equals(REMOVED.toString())) {
41             return REMOVED;
42         }
43         if (statusString.equals(MODIFIED.toString())) {
44             return MODIFIED;
45         }
46         if (statusString.equals(UP_TO_DATE.toString())) {
47             return UP_TO_DATE;
48         }
49         if (statusString.equals(NEEDS_CHECKOUT.toString())) {
50             return NEEDS_CHECKOUT;
51         }
52         if (statusString.equals(NEEDS_MERGE.toString())) {
53             return NEEDS_MERGE;
54         }
55         if (statusString.equals(NEEDS_PATCH.toString())) {
56             return NEEDS_PATCH;
57         }
58         if (statusString.equals(HAS_CONFLICTS.toString())) {
59             return HAS_CONFLICTS;
60         }
61         if (statusString.equals(UNRESOLVED_CONFLICT.toString())) {
62             return UNRESOLVED_CONFLICT;
63         }
64         if (statusString.equals(UNKNOWN.toString())) {
65             return UNKNOWN;
66         }
67         if (statusString.equals(INVALID.toString())) {
68             return INVALID;
69         }
70         return null;
71     }
72
73     /**
74      * The Added status, i.e. the file has been added to the repository
75      * but not committed yet.
76      */

77     public static final FileStatus ADDED = new FileStatus("Locally Added"); //NOI18N
78

79     /**
80      * The Removed status, i.e. the file has been removed from the repository
81      * but not committed yet
82      */

83     public static final FileStatus REMOVED = new FileStatus("Locally Removed"); //NOI18N
84

85     /**
86      * The locally modified status, i.e. the file has been modified locally
87      * and is out of sync with the repository
88      */

89     public static final FileStatus MODIFIED = new FileStatus("Locally Modified"); //NOI18N
90

91     /**
92      * The up-to-date status, i.e. the file is in sync with the repository
93      */

94     public static final FileStatus UP_TO_DATE = new FileStatus("Up-to-date"); //NOI18N
95

96     /**
97      * The "needs checkout" status, i.e. the file is out of sync with the
98      * repository and needs to be updated
99      */

100     public static final FileStatus NEEDS_CHECKOUT = new FileStatus("Needs Checkout"); //NOI18N
101

102     /**
103      * The "needs patch" status, i.e. the file is out of sync with the
104      * repository and needs to be patched
105      */

106     public static final FileStatus NEEDS_PATCH = new FileStatus("Needs Patch"); //NOI18N
107

108     /**
109      * The "needs merge" status, i.e. the file is locally modified and
110      * the file in the repository has been modified too
111      */

112     public static final FileStatus NEEDS_MERGE = new FileStatus("Needs Merge"); //NOI18N
113

114     /**
115      * The "conflicts" status, i.e. the file has been merged and now
116      * has conflicts that need resolved before it can be checked-in
117      */

118     public static final FileStatus HAS_CONFLICTS = new FileStatus("File had conflicts on merge"); //NOI18N
119

120     /**
121      * A file with the same name as this new file has been added to the
122      * repository from a second workspace. This file will need to be moved out
123      * of the way to allow an update to complete.
124      */

125     public static final FileStatus UNRESOLVED_CONFLICT = new FileStatus("Unresolved Conflict"); // NOI18N
126

127     /**
128      * The unknown status, i.e. the file is not known to the CVS repository.
129      */

130     public static final FileStatus UNKNOWN = new FileStatus("Unknown"); //NOI18N
131

132     /**
133      * The entry is invalid, appropriate file in CVS repository can not be found.
134      */

135     public static final FileStatus INVALID = new FileStatus("Entry Invalid"); // NOI18N
136

137     private final String JavaDoc statusString;
138
139     /**
140      * Do not construct a FileStatus object youself, but use one of the static
141      * constants.
142      */

143     private FileStatus(String JavaDoc statusString) {
144         this.statusString = statusString;
145     }
146
147     /**
148      * Returns the String representation for thiz.
149      */

150     public String JavaDoc toString() {
151         return statusString;
152     }
153 }
Popular Tags