fr.gouv.culture.sdx.utils.database
Class DatabaseEntity

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.database.DatabaseEntity
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled

public class DatabaseEntity
extends java.lang.Object
implements org.apache.avalon.framework.logger.LogEnabled

An entity from a _database, basically a list of properties.

The entity is the database basic unit of management. It can have properties, all properties have a unique name but a property may have multiple values.

TODO?: this class is not completely implemented.


Constructor Summary
DatabaseEntity(java.lang.String id)
          Creates an instance with the specified id
 
Method Summary
 void addProperties(java.lang.String name, java.lang.String[] values)
          Adds or updates a property with a list of values to a DatabaseEntity.
 void addProperty(java.lang.String name, java.lang.String value)
           
 boolean containsProperty(java.lang.String name)
           
 boolean containsValue(java.lang.String propertyName, java.lang.String propertyValue)
           
 void deleteProperty(java.lang.String name)
          Deletes a properties object
 void deleteValue(java.lang.String propertyName, java.lang.String value)
          Delete a valud from a property of this entity
 void dump(java.io.PrintStream ps)
          Dumps a debug info of this object.
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
          Sets the super.getLog().
 java.lang.String getId()
          Returns the id for this entity
 Property[] getProperties()
          Get's all the ContextKeys of this Database Entity
 java.lang.String getProperty(java.lang.String name)
          Get's the first value of the Property specified by a name
 java.lang.String[] getPropertyValues(java.lang.String name)
          Get's the values of a of the Property specified by a name
 void setId(java.lang.String id)
          Modifies the id for this entity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseEntity

public DatabaseEntity(java.lang.String id)
               throws SDXException
Creates an instance with the specified id

Parameters:
id - The id to assign to this entity
Throws:
SDXException
Method Detail

getId

public java.lang.String getId()
Returns the id for this entity


setId

public void setId(java.lang.String id)
Modifies the id for this entity


enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Sets the super.getLog().

Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled
Parameters:
logger - The super.getLog() to use.

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value)

addProperties

public void addProperties(java.lang.String name,
                          java.lang.String[] values)
Adds or updates a property with a list of values to a DatabaseEntity.

If a property by the name specified already exists, the values are added to the property's list of values, if one wishes to replace the existing property, the property should be deleted first using the deleteProperty(String name) in this class, and then re-add the property

Parameters:
name - The name to assign to the Property
values - An array of String values for the property

getProperty

public java.lang.String getProperty(java.lang.String name)
Get's the first value of the Property specified by a name

Parameters:
name - The name of an existing the Property
Returns:
The first value of the specified property

getPropertyValues

public java.lang.String[] getPropertyValues(java.lang.String name)
Get's the values of a of the Property specified by a name

Parameters:
name - The name of an existing the Property
Returns:
A String array of the values of the specified property

getProperties

public Property[] getProperties()
Get's all the ContextKeys of this Database Entity

Returns:
An array of Property objects

deleteProperty

public void deleteProperty(java.lang.String name)
                    throws SDXException
Deletes a properties object

Parameters:
name - The name of the property to be deleted
Throws:
SDXException - If the name is null or an empty String.

deleteValue

public void deleteValue(java.lang.String propertyName,
                        java.lang.String value)
                 throws SDXException
Delete a valud from a property of this entity

Parameters:
propertyName - The propertyname
value - The value to delete
Throws:
SDXException

dump

public void dump(java.io.PrintStream ps)
Dumps a debug info of this object.


containsProperty

public boolean containsProperty(java.lang.String name)

containsValue

public boolean containsValue(java.lang.String propertyName,
                             java.lang.String propertyValue)


Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.