|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.nds.dirxml.engine.gcv.GCValue
Base class for all Global Configuration Value types.
Field Summary | |
protected boolean |
modified
|
protected GCParent |
parent
|
static int |
TYPE_BOOLEAN
Integer constant representing "boolean" value type |
static int |
TYPE_DN
Integer constant representing "dn" value type |
static int |
TYPE_DN_REF
Integer constant representing "dn-ref" value type |
static int |
TYPE_ENUM
Integer constant representing "enum" value type |
static int |
TYPE_GCV_REF
Integer constant representing "gcv-ref" element |
static int |
TYPE_GROUP
Integer constant representing "group" element |
static int |
TYPE_HEADER
Integer constant representing "header" element |
static int |
TYPE_INTEGER
Integer constant representing "integer" value type |
static int |
TYPE_LIST
Integer constant representing "list" value type |
static int |
TYPE_PASSWORD_REF
Integer constant representing "password-ref" value type |
static int |
TYPE_REAL
Integer constant representing "real" value type |
static int |
TYPE_STRING
Integer constant representing "string" value type |
static int |
TYPE_SUBORDINATES
Integer constant representing "subordinates" element |
Method Summary | |
static GCValue |
construct(String name,
String displayName,
int type)
Construct a GCValue object given the name, display name, and type.
|
static GCValue |
construct(String name,
String displayName,
String displayNameRef,
int type)
Construct a GCValue object given the name, display name, and type.
|
static GCValue |
constructGCVRef(String name)
Construct a GCVRef instance. |
static GCValue |
constructGroup(GCDefinitions owner)
Construct a GCGroup instance. |
static GCValue |
constructHeader(String displayName)
Construct a GCHeader instance. |
static GCValue |
constructSubordinates(String activeValue,
GCDefinitions owner)
Construct a GCSubordinates instance. |
String |
getDescription()
Get the description, if any, of this value. |
String |
getDescriptionRef()
Return the description localization reference, if any. |
String |
getDisplayName()
Return the display name of this value. |
String |
getDisplayNameRef()
Return the display name localization reference, if any. |
boolean |
getHidden()
Get whether this GCV should be hidden in the user interface. |
String |
getName()
Return the name of this value. |
int |
getType()
Return the int value representing the type of this value. |
String |
getTypeString()
Return the String identifying the type of this value. |
abstract String |
getValue()
Get the current value for this instance. |
Node |
getXMLValue(Document document)
Return an XML node representing this GCV's value. |
boolean |
hasBeenModified()
Return true if this instance has been modified.
|
void |
localize(LocalizedMessageSource messageSource)
Localize the display name and/or descriptions if there are localization refs for them. |
abstract void |
parseValue(String value)
Parse the passed value based on the type and instance rules for this value. |
void |
resetModified()
Reset the modified flag for this instance such that hasBeenModified()
will return false . |
void |
setDescription(String description)
Set the description for this value. |
void |
setDescriptionRef(String descriptionRef)
Set the description localization reference. |
void |
setDisplayName(String displayName)
Set the display name of this value. |
void |
setDisplayNameRef(String displayNameRef)
Set the display name localization reference. |
void |
setHidden(boolean hidden)
Set whether this GCV should be hidden in the user interface. |
abstract void |
setValue(String value)
Set the value for this instance. |
Element |
toXML(Node parent)
Create an XML representation for this instance under the passed Node .
|
static int |
typeFromString(String typeString)
Return an integer constant based on a type string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int TYPE_STRING
"string"
value type
public static final int TYPE_BOOLEAN
"boolean"
value type
public static final int TYPE_INTEGER
"integer"
value type
public static final int TYPE_REAL
"real"
value type
public static final int TYPE_DN
"dn"
value type
public static final int TYPE_ENUM
"enum"
value type
public static final int TYPE_PASSWORD_REF
"password-ref"
value type
public static final int TYPE_GCV_REF
"gcv-ref"
element
public static final int TYPE_HEADER
"header"
element
public static final int TYPE_GROUP
"group"
element
public static final int TYPE_SUBORDINATES
"subordinates"
element
public static final int TYPE_LIST
"list"
value type
public static final int TYPE_DN_REF
"dn-ref"
value type
protected boolean modified
protected GCParent parent
Method Detail |
public static GCValue construct(String name, String displayName, int type) throws GCVException
GCValue
object given the name, display name, and type.
The constructed object may not be complete. For example, an "enum"
object will not have any enum choices, nor will the value be set.
name
- The name of the Global Configuration ValuedisplayName
- The user-interface name of the GCV.type
- The type of value to construct (TYPE_STRING
, TYPE_BOOLEAN
, etc.).
GCValue
-based object.
GCVException
- thrown if name
or displayName
is null
or empty, or if the type is not valid.public static GCValue constructHeader(String displayName) throws GCVException
GCHeader
instance.
displayName
- display value for header
GCHeader
instance.
GCVException
- thrown if displayName
is invalidpublic static GCValue constructGroup(GCDefinitions owner) throws GCVException
GCGroup
instance.
owner
- GCDefinitions
instance that owns the group.
GCGroup
instance.
GCVException
- not thrownpublic static GCValue constructSubordinates(String activeValue, GCDefinitions owner) throws GCVException
GCSubordinates
instance.
owner
- GCDefinitions
instance that owns the group.activeValue
- "active-value"
attribute value.
GCSubordinates
instance.
GCVException
- thrown if activeValue
is incorrect.public static GCValue constructGCVRef(String name) throws GCVException
GCVRef
instance.
name
- name of GCV to reference.
GCVRef
instance.
GCVException
- thrown if name
is null
or empty.public static GCValue construct(String name, String displayName, String displayNameRef, int type) throws GCVException
GCValue
object given the name, display name, and type.
The constructed object may not be complete. For example, an "enum"
object will not have any enum choices, nor will the value be set.
name
- The name of the Global Configuration ValuedisplayName
- The user-interface name of the GCV.displayNameRef
- A localized string identifier that can be used to obtain a
localized version of the display name, given a LocalizedMessageSource instance.type
- The type of value to construct (TYPE_STRING
, TYPE_BOOLEAN
, etc.).
GCValue
-based object.
GCVException
- thrown if the name or display name is null
or empty, or if the type is not valid.public boolean hasBeenModified()
true
if this instance has been modified.
The instance is considered to have been modified if a change was made
that affects the persistent representation since:
resetModified()
was last called
hasBeenModified
in interface ConfigElement
true
or false
resetModified()
public void resetModified()
hasBeenModified()
will return false
.
resetModified
in interface ConfigElement
hasBeenModified()
public String getName()
String
(never null
).public int getType()
int
value representing the type of this value.
TYPE_STRING
, TYPE_BOOLEAN
, etc.public String getTypeString()
String
identifying the type of this value.
null
).public String getDisplayName()
null
).public void setDisplayName(String displayName) throws GCVArgumentException
displayName
- non-null
, non-empty String
for display purposes.
GCVArgumentException
- thrown if displayName
is null
or empty.public String getDisplayNameRef()
null
.public void setDisplayNameRef(String displayNameRef)
displayNameRef
- A string identifier in a Properties
collection that can be
used with LocalizedMessageSource
.public String getDescription()
null
, or an empty string.
String
, or null
public void setDescription(String description)
description
- Description String
(may be empty or null
).public String getDescriptionRef()
null
.public void setDescriptionRef(String descriptionRef)
descriptionRef
- A string identifier in a Properties
collection that can be
used with LocalizedMessageSource
.public void setHidden(boolean hidden)
hidden
- true
or false
public boolean getHidden()
true
or false
public abstract void parseValue(String value) throws GCVException
The type rules are lexicographic and value-based. For example,
an integer must consist of only characters '0'
through '9'
, with an
optional leading '-'
. In addition, the integer value represented by
the string must not exceed java.lang.Integer.MIN_VALUE
and
java.lang.Integer.MAX_VALUE
.
The instance rules depend on the instance of the value. If, for example,
this instance is an "integer"
type and there is a range restriction, then
the passed value must fall within the range restriction.
value
- Value String
to parse
GCVException
- thrown if value is not correct for this value instance.public abstract String getValue()
null
,
but the value may not be correct if it has not yet been set. For example,
a newly-constructed "enum"
object will have an empty, invalid value of ""
.
String
public abstract void setValue(String value) throws GCVException
parseValue()
must not throw an exception when
passed the value.
value
- Value String
for this instance.
GCVException
- thrown if value is not correct for this value instance.public Node getXMLValue(Document document)
Text
node containing the value
returned by getValue()
. Certain GCV types (e.g., "list"
) may
return more structured data.
document
- the Document
to use to create nodes.
Node
that is the root of the XML representation.public Element toXML(Node parent)
Node
.
Note that the act of creating an XML representation does not reset this instance's
modified flag. It must be reset by calling resetModified()
.
toXML
in interface ConfigElement
parent
- Node
under which to construct XML representation.
Element
hasBeenModified()
,
resetModified()
public void localize(LocalizedMessageSource messageSource)
If the display name or description has a localization refs, but the localized string
cannot be located in the passed LocalizedMessageSource
they are left unlocalized.
messageSource
- Source for localized strings.public static int typeFromString(String typeString)
e.g., "integer"
-> TYPE_INTEGER
typeString
- string describing type ("string"
, "integer"
, "enum"
, etc.)
TYPE_STRING
, TYPE_INTEGER
, TYPE_ENUM
) or -1
if string
is invalid.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |