KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > rc > FileReservedCheckInException


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
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  */

17
18 /* $Id: FileReservedCheckInException.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.cms.rc;
21
22 import java.util.Date JavaDoc;
23
24
25 /**
26  * Reserved check-in exception
27  */

28 public class FileReservedCheckInException extends Exception JavaDoc {
29     private String JavaDoc source = null;
30     private Date JavaDoc date = null;
31     private String JavaDoc username = null;
32     private String JavaDoc typeString = null;
33     private short type;
34
35     /**
36      * Creates a new FileReservedCheckInException object.
37      *
38      * @param source DOCUMENT ME!
39      * @param rcml DOCUMENT ME!
40      *
41      * @throws Exception DOCUMENT ME!
42      */

43     public FileReservedCheckInException(String JavaDoc source, RCML rcml)
44         throws Exception JavaDoc {
45         this.source = source;
46
47         try {
48             RCMLEntry rcmlEntry = rcml.getLatestEntry();
49
50             username = rcmlEntry.getIdentity();
51             date = new Date JavaDoc(rcmlEntry.getTime());
52             type = rcmlEntry.getType();
53
54             if (type == RCML.co) {
55                 typeString = "Checkout";
56             } else {
57                 typeString = "Checkin";
58             }
59         } catch (Exception JavaDoc exception) {
60             throw new Exception JavaDoc("Unable to create FileReservedCheckInException object!");
61         }
62     }
63
64     /**
65      * DOCUMENT ME!
66      *
67      * @return DOCUMENT ME!
68      */

69     public String JavaDoc getMessage() {
70         return "Unable to check in the file " + this.source + " because of a " + this.typeString +
71         " by user " + this.username + " at " + this.date;
72     }
73     /**
74      * Get the date
75      *
76      * @return the date
77      */

78     public Date JavaDoc getDate() {
79         return date;
80     }
81
82     /**
83      * Get the typeString
84      *
85      * @return the type string
86      */

87     public String JavaDoc getTypeString() {
88         return typeString;
89     }
90
91     /**
92      * Get the user name.
93      *
94      * @return the user name
95      */

96     public String JavaDoc getUsername() {
97         return username;
98     }
99
100     /**
101      * Get source
102      *
103      * @return source
104      */

105     public String JavaDoc getSource() {
106         return source;
107     }
108 }
109
Popular Tags