org.apache.oodt.profile
Class ProfileElement

java.lang.Object
  extended by org.apache.oodt.profile.ProfileElement
All Implemented Interfaces:
Serializable, Cloneable, Comparable, Documentable
Direct Known Subclasses:
EnumeratedProfileElement, RangedProfileElement, UnspecifiedProfileElement

public abstract class ProfileElement
extends Object
implements Serializable, Cloneable, Comparable, Documentable

Profile element. Objects of this class are elements that describe the composition of a resource.

Author:
Kelly
See Also:
Serialized Form

Field Summary
protected  String comments
          My optional comments.
protected  String desc
          My optional description.
protected  String id
          My optional id.
protected  int maxOccurrence
          My maxOccurrence.
protected  String name
          My required name.
protected  boolean obligation
          My obligation.
protected  Profile profile
          My profile.
protected  List synonyms
          My synonyms.
protected  String type
          My optional type.
protected  String unit
          My optional unit.
 
Constructor Summary
protected ProfileElement(Profile profile)
          Create blank profile attributes belonging to the given profile.
protected ProfileElement(Profile profile, String name, String id, String desc, String type, String unit, List synonyms, boolean obligation, int maxOccurrence, String comments)
          Create a profile element from constituent attributes.
 
Method Summary
protected abstract  void addElementSpecificProperties(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource element, ProfileAttributes profAttr, URI uri)
          Add the statements specific to this kind of profile element to an RDF model.
protected abstract  void addValues(Node node)
          Add the values of this element to the given node.
 Object clone()
           
 int compareTo(Object rhs)
           
static Document createProfElementDocument()
          Create a <profElement> document using the profiles DTD.
static ProfileElement createProfileElement(Element root, Profile profile, ObjectFactory factory)
          Create a profile element from the given XML node.
static Set elements(Set profiles, Set elements)
          Given a set of profiles and of profile elements, return those elements that are owned by any of the given profiles.
 boolean equals(Object rhs)
           
 String getComments()
          Get any comments about me.
 String getDescription()
          Get my long description.
 String getID()
          Get my element ID.
 int getMaxOccurrence()
          Get how many times I can occur.
abstract  String getMaxValue()
          Get my maximum value.
abstract  String getMinValue()
          Get my minimum value.
 String getName()
          Get my name.
 Profile getProfile()
          Get the profile to whom I belong.
 List getSynonyms()
          Get my synonyms.
 String getType()
          Get my type.
 String getUnit()
          Get my unit.
abstract  List getValues()
          Get legal values.
 int hashCode()
           
protected abstract  boolean isEnumerated()
          Tell if this element is of the enumerated kind.
 boolean isObligatory()
          Am I obligatory?
static Set profiles(Set elements)
          Given a set of profile elements, return a set of profiles that own those elements.
 void setComments(String comments)
          Set any comments about me.
 void setDescription(String desc)
          Set my long description.
 void setID(String id)
          Set my element ID.
 void setMaxOccurrence(int occurrence)
          Set how many times I can occur.
 void setName(String name)
          Set my name.
 void setObligation(boolean obligatory)
          Set whether I'm obligatory.
 void setProfile(Profile profile)
          Set the profile to whom I belong.
 void setType(String type)
          Set my type.
 void setUnit(String unit)
          Set my unit.
 String toString()
           
 Node toXML(Document doc)
          Serialize this element as an XML node.
 Node toXMLWithoutValues(Document doc)
          Serialize this element as an XML node without any values.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

profile

protected Profile profile
My profile.


name

protected String name
My required name.


id

protected String id
My optional id.


desc

protected String desc
My optional description.


type

protected String type
My optional type.


unit

protected String unit
My optional unit.


synonyms

protected List synonyms
My synonyms.


obligation

protected boolean obligation
My obligation.


maxOccurrence

protected int maxOccurrence
My maxOccurrence.


comments

protected String comments
My optional comments.

Constructor Detail

ProfileElement

protected ProfileElement(Profile profile)
Create blank profile attributes belonging to the given profile.


ProfileElement

protected ProfileElement(Profile profile,
                         String name,
                         String id,
                         String desc,
                         String type,
                         String unit,
                         List synonyms,
                         boolean obligation,
                         int maxOccurrence,
                         String comments)
Create a profile element from constituent attributes.

Parameters:
profile - Profile to which this element belongs.
name - Required name of the element.
id - ID of the element.
desc - Long description of the element.
type - Data type of the element.
unit - Units.
synonyms - Collection of element IDs (String) that are synonyms for this element.
obligation - True if this is a required element
maxOccurrence - Maximum number of occurrences of this element.
comments - Any comments about this element.
Method Detail

createProfileElement

public static ProfileElement createProfileElement(Element root,
                                                  Profile profile,
                                                  ObjectFactory factory)
Create a profile element from the given XML node.

Parameters:
root - The <profElement> node.
profile - To what profile the element belongs.
Returns:
A profile element.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object rhs)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
Overrides:
clone in class Object

compareTo

public int compareTo(Object rhs)
Specified by:
compareTo in interface Comparable

getProfile

public Profile getProfile()
Get the profile to whom I belong.

Returns:
The owning profile.

getName

public String getName()
Get my name.

Returns:
My name.

getID

public String getID()
Get my element ID.

Returns:
My ID.

getDescription

public String getDescription()
Get my long description.

Returns:
My long description.

getType

public String getType()
Get my type.

Returns:
My type.

getUnit

public String getUnit()
Get my unit.

Returns:
My unit.

getSynonyms

public List getSynonyms()
Get my synonyms.

Returns:
A list of synonyms.

isObligatory

public boolean isObligatory()
Am I obligatory?

Returns:
True if I am, false otherwise.

getMaxOccurrence

public int getMaxOccurrence()
Get how many times I can occur.

Returns:
How many times I can occur.

getComments

public String getComments()
Get any comments about me.

Returns:
Any comments.

setProfile

public void setProfile(Profile profile)
Set the profile to whom I belong.

Parameters:
profile - The owning profile.

setName

public void setName(String name)
Set my name.

Parameters:
name - My name.

setID

public void setID(String id)
Set my element ID.

Parameters:
id - My ID.

setDescription

public void setDescription(String desc)
Set my long description.

Parameters:
desc - My long description.

setType

public void setType(String type)
Set my type.

Parameters:
type - My type.

setUnit

public void setUnit(String unit)
Set my unit.

Parameters:
unit - My unit.

setObligation

public void setObligation(boolean obligatory)
Set whether I'm obligatory.

Parameters:
obligatory - True if I am, false otherwise.

setMaxOccurrence

public void setMaxOccurrence(int occurrence)
Set how many times I can occur.

Parameters:
occurrence - How many times I can occur.

setComments

public void setComments(String comments)
Set any comments about me.

Parameters:
comments - Any comments.

getMinValue

public abstract String getMinValue()
Get my minimum value.

Returns:
My minimum value.

getMaxValue

public abstract String getMaxValue()
Get my maximum value.

Returns:
My maximum value.

getValues

public abstract List getValues()
Get legal values.

Returns:
List of legal values (as Strings).

toXML

public Node toXML(Document doc)
           throws DOMException
Serialize this element as an XML node.

Specified by:
toXML in interface Documentable
Parameters:
doc - The document that will own this node.
Returns:
The XML element <resAttributes> representing these attributes.
Throws:
DOMException - If an error occurs creating the XML nodes.

toXMLWithoutValues

public Node toXMLWithoutValues(Document doc)
                        throws DOMException
Serialize this element as an XML node without any values.

Parameters:
doc - The document that will own this node.
Returns:
The XML element <resAttributes> representing these attributes.
Throws:
DOMException - If an error occurs creating the XML nodes.

isEnumerated

protected abstract boolean isEnumerated()
Tell if this element is of the enumerated kind.

Returns:
a boolean value.

addValues

protected abstract void addValues(Node node)
                           throws DOMException
Add the values of this element to the given node.

Parameters:
node - The node to add to.
Throws:
DOMException - If an error occurs creating the XML nodes.

addElementSpecificProperties

protected abstract void addElementSpecificProperties(com.hp.hpl.jena.rdf.model.Model model,
                                                     com.hp.hpl.jena.rdf.model.Resource element,
                                                     ProfileAttributes profAttr,
                                                     URI uri)
Add the statements specific to this kind of profile element to an RDF model.

Parameters:
model - The model.
element - This element, as an RDF resource.
profAttr - The attributes of the element's profile.

createProfElementDocument

public static Document createProfElementDocument()
Create a <profElement> document using the profiles DTD.

Returns:
A <profElement> document with the profiles DTD.

profiles

public static Set profiles(Set elements)
Given a set of profile elements, return a set of profiles that own those elements.

Parameters:
elements - Profile elements.
Returns:
Profiles that own those elements.

elements

public static Set elements(Set profiles,
                           Set elements)
Given a set of profiles and of profile elements, return those elements that are owned by any of the given profiles.

Parameters:
profiles - Profiles.
elements - Profile elements.
Returns:
Members of elements that are owned by members of profiles.


Copyright © 1999-2013
Apache OODT. All Rights Reserved.