KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > common > EntityStatus


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.common;
25
26 /**
27     A class representing the <code> status </code> of an entity.
28     @author Kedar Mhaswade
29     @version 1.0
30 */

31
32 public class EntityStatus extends Status
33 {
34     /* javac 1.3 generated serialVersionUID */
35     public static final long serialVersionUID = 120287380119583589L;
36
37     public static final String JavaDoc kEnabledStr = "enabled";
38     public static final String JavaDoc kDisabledStr = "disabled";
39
40     /**
41         Creates new EntityStatus that represents an <code>ENABLED </code> entity.
42     */

43     public EntityStatus()
44     {
45         super(Status.kEntityEnabledCode, kEnabledStr);
46     }
47
48     /**
49      */

50     public EntityStatus(int code, String JavaDoc str)
51     {
52         super(code, str);
53     }
54
55     public void setDisabled()
56     {
57         if (!isDisabled())
58         {
59             mStatusCode = Status.kEntityDisabledCode;
60             mStatusString = kDisabledStr;
61         }
62     }
63
64     /**
65      *
66      */

67     public void setEnabled()
68     {
69         if (!isEnabled())
70         {
71             mStatusCode = Status.kEntityEnabledCode;
72             mStatusString = kEnabledStr;
73         }
74     }
75
76     /**
77             Returns whether the entity is enabled.
78
79             @return true if the entity is enabled, false otherwise
80     */

81     public boolean isEnabled ()
82     {
83         return (mStatusCode == Status.kEntityEnabledCode);
84     }
85
86     /**
87             Returns whether the entity is disabled.
88
89             @return true if the entity is disabled, false otherwise
90     */

91     public boolean isDisabled ()
92     {
93         return (mStatusCode == Status.kEntityDisabledCode);
94     }
95 }
Popular Tags