se.kmr.scam.editor.util
Class ValueObjectImpl

java.lang.Object
  extended byse.kmr.scam.editor.util.ValueObjectImpl
All Implemented Interfaces:
ValueObject

public class ValueObjectImpl
extends Object
implements ValueObject

Wrapper for a fact in a value model.

Version:
$Revision: 1.22 $
Author:
Jöran
Created:
den 2 augusti 2002

Constructor Summary
ValueObjectImpl(RDFNode node, Resource variable)
          Constructor for the ValueObject object Objects from this constructor should only be used for static values, this since the RDFNode can not be updated.
ValueObjectImpl(Statement statement, Resource Variable)
          Constructor for the ValueObject object
ValueObjectImpl(String value, String language, Resource variable)
          Deprecated.  
 
Method Summary
 ValueObject duplicate()
          Creates a (structural) duplicate of this object, all values are set to default.
 int getId()
          Deprecated.  
 String getLanguage()
          Gets the literalLanguage attribute of the ValueObject object
 RDFNode getNode()
          Gets the node attribute of the ValueObject object
 Property getPredicate()
           
 Resource getResource()
          Gets the resource attribute of the ValueObject object
 Resource getSubject()
          Gets the subject attribute of the ValueObject object
 String getValue()
          Gets the language attribute of the value, if such exists.
 boolean isDummy()
          Tells wether a valueobject is empty, i.e. set to a dummy value.
 boolean isEdited()
           
 int isOk()
          OBS OBS OBS, THIS FUNCTION IS UNUSED AND I CAN'T FIGURE IT'S FUNCTION.
 boolean isValid()
           
 void remove()
          Removes the fact from the RDF-model
 void removeValueAndPossibleConstraints()
          Removes the fact from the RDF-model by calling the remove() and then all other constraints from the value-node in the case it is a resource.
 void setEdited(boolean edited)
           
 void setPredicate(Property newPredicate)
           
 void setValid(boolean valid)
          Used for validation of values in forms.
 void setValue(String value)
          Sets the literal value of the fact.
 void setValue(String value, String language)
          Sets the value of the fact.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueObjectImpl

public ValueObjectImpl(String value,
                       String language,
                       Resource variable)
Deprecated.  

Constructor for the ValueObject object

Parameters:
value - Description of the Parameter
language - Description of the Parameter

ValueObjectImpl

public ValueObjectImpl(Statement statement,
                       Resource Variable)
Constructor for the ValueObject object

Parameters:
statement - the statement that represents the fact.

ValueObjectImpl

public ValueObjectImpl(RDFNode node,
                       Resource variable)
Constructor for the ValueObject object Objects from this constructor should only be used for static values, this since the RDFNode can not be updated. For objects that may be updated use ValueObjct(Statement statement) .

Parameters:
node - the node that represents the fact.
Method Detail

getId

public int getId()
Deprecated.  

Gets the id attribute of the ValueObject object

Returns:
The id value

getNode

public RDFNode getNode()
Gets the node attribute of the ValueObject object

Specified by:
getNode in interface ValueObject
Returns:
The node value

getSubject

public Resource getSubject()
Gets the subject attribute of the ValueObject object

Specified by:
getSubject in interface ValueObject
Returns:
The subject value

getResource

public Resource getResource()
Gets the resource attribute of the ValueObject object

Specified by:
getResource in interface ValueObject
Returns:
The node value, as a resource.

getValue

public String getValue()
Gets the language attribute of the value, if such exists.

Specified by:
getValue in interface ValueObject
Returns:
The string value of the language. The string is empty if no language exists.

getLanguage

public String getLanguage()
Gets the literalLanguage attribute of the ValueObject object

Specified by:
getLanguage in interface ValueObject
Returns:
The literalLanguage value

setValue

public void setValue(String value)
              throws RDFException
Sets the literal value of the fact.

Specified by:
setValue in interface ValueObject
Parameters:
value - The new value
Throws:
RDFException - thrown in case of exception while updating the object.

setValue

public void setValue(String value,
                     String language)
              throws RDFException
Sets the value of the fact. If the fact is represented by a Literal the value will be set with a language attribute. (The language attribute will only set if the language argument is non-null)
For facts that is represented by Resource will the language argument have no effect.

Specified by:
setValue in interface ValueObject
Parameters:
value - The new value
language - The new language value
Throws:
RDFException - thrown if the value is null, the object represents a root node or in case of exception while updating the data model.

setPredicate

public void setPredicate(Property newPredicate)
                  throws RDFException
Specified by:
setPredicate in interface ValueObject
Throws:
RDFException

getPredicate

public Property getPredicate()
                      throws RDFException
Specified by:
getPredicate in interface ValueObject
Throws:
RDFException

duplicate

public ValueObject duplicate()
                      throws RDFException
Creates a (structural) duplicate of this object, all values are set to default. Typically is this method used for duplicating ValueObject that wraps facts in form of Statements

NOTE: The data model is updated with the new object

Specified by:
duplicate in interface ValueObject
Returns:
If this object represents a Statement a (structural)duplicate of this object, otherwise null.
Throws:
RDFException - thrown in case of exception while duplicating the Statement

remove

public void remove()
            throws RDFException
Removes the fact from the RDF-model

Specified by:
remove in interface ValueObject
Throws:
RDFException - thrown in case of exception while removing fact from the RDF-model.

removeValueAndPossibleConstraints

public void removeValueAndPossibleConstraints()
                                       throws RDFException
Description copied from interface: ValueObject
Removes the fact from the RDF-model by calling the ValueObject.remove() and then all other constraints from the value-node in the case it is a resource.

Specified by:
removeValueAndPossibleConstraints in interface ValueObject
Throws:
RDFException - thrown in case of exception while removing fact from the RDF-model.

toString

public String toString()
Returns a string representation of the object.

Returns:
a string representation of the object

setEdited

public void setEdited(boolean edited)
Specified by:
setEdited in interface ValueObject

setValid

public void setValid(boolean valid)
Description copied from interface: ValueObject
Used for validation of values in forms.

Specified by:
setValid in interface ValueObject

isEdited

public boolean isEdited()
Specified by:
isEdited in interface ValueObject
Returns:

isValid

public boolean isValid()
Specified by:
isValid in interface ValueObject
Returns:

isOk

public int isOk()
Description copied from interface: ValueObject
OBS OBS OBS, THIS FUNCTION IS UNUSED AND I CAN'T FIGURE IT'S FUNCTION. Enlighten me by explaining it here.... Otherwise I will remove it. /Matthias

Specified by:
isOk in interface ValueObject
Returns:

isDummy

public boolean isDummy()
Description copied from interface: ValueObject
Tells wether a valueobject is empty, i.e. set to a dummy value.

Specified by:
isDummy in interface ValueObject
Returns:
boolean


Copyright © 2003 SCAM. All Rights Reserved.