2.17.2: 2011-06-17

net.sf.basedb.core
Class Values

java.lang.Object
  extended by net.sf.basedb.core.Values

final class Values
extends Object

Utility class to handle the conversion between data objects and item objects. Only item objects are safe to be exposed to client applications and plugins, but the database contains data objects.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2010-08-13 10:50:27 +0200 (Fri, 13 Aug 2010) $

Constructor Summary
Values()
           
 
Method Summary
(package private) static Object getDataValue(Object value)
          Convert an item values to a data value.
(package private) static List<Object> getDataValues(List<?> itemValues)
          Convert a list of item values to data values.
(package private) static Object getItemValue(DbControl dc, Object value)
          Convert a a data value to a item value.
(package private) static List<Object> getItemValues(DbControl dc, List<?> dataValues)
          Convert a list of data values to item values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Values

Values()
Method Detail

getItemValue

static Object getItemValue(DbControl dc,
                           Object value)
                    throws PermissionDeniedException,
                           BaseException
Convert a a data value to a item value. Ie. BasicData objects will be converted to their correspoding BasicItem objects, Date:s will be copied since they are mutable, etc. This method is needed for example by the Annotation.getValues() method to make sure that the database can't be modified without the proper permissions.

Objects implementing the BatchableData interface are not converted since these objects are safe for use with clients if they are evicted from the Hibernate session.

Parameters:
dc - The DbControl to use for item conversion and eviction
value - The value to convert
Throws:
PermissionDeniedException - If the value is an item which the logged in user doesn't have read permission for
BaseException - If there is another error

getItemValues

static List<Object> getItemValues(DbControl dc,
                                  List<?> dataValues)
                           throws PermissionDeniedException,
                                  ItemNotFoundException,
                                  BaseException
Convert a list of data values to item values.

Throws:
PermissionDeniedException
ItemNotFoundException
BaseException
See Also:
getItemValue(DbControl, Object)

getDataValue

static Object getDataValue(Object value)
Convert an item values to a data value. Ie. BasicItem objects will be converted to their correspoding BasicData objects, Date:s will be copied since they are mutable, etc.

Parameters:
value - The value to convert

getDataValues

static List<Object> getDataValues(List<?> itemValues)
Convert a list of item values to data values.

See Also:
getDataValue(Object)

2.17.2: 2011-06-17