|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.BasicItem<QuantityData> net.sf.basedb.core.Quantity
public class Quantity
This class is used to represent a quantity for specifying units to annotations.
Unit
,
Essentials of
the SI: Base & derived unitsField Summary | |
---|---|
static String |
ABSORBED_DOSE
The id for the Quantity object representing absorbed dose. |
static String |
ACCELERATION
The id for the Quantity object representing acceleration. |
static String |
ANGLE
The id for the Quantity object representing angle. |
static String |
AREA
The id for the Quantity object representing area. |
static String |
CAPACITANCE
The id for the Quantity object representing capacitance. |
static String |
CHARGE
The id for the Quantity object representing electrical charge. |
static String |
CURRENT
The id for the Quantity object representing electric current. |
static String |
DENSITY
The id for the Quantity object representing density. |
static String |
ENERGY
The id for the Quantity object representing energy. |
static String |
EQUIVALENT_DOSE
The id for the Quantity object representing equivalent dose. |
static String |
FLOW_RATE
The id for the Quantity object representing flow rate. |
static String |
FORCE
The id for the Quantity object representing force. |
static String |
FRACTION
The id for the Quantity object representing fractions. |
static String |
FREQUENCY
The id for the Quantity object representing frequency. |
static String |
LENGTH
The id for the Quantity object representing length. |
static String |
MAGNETIC_FIELD
The id for the Quantity object representing magnetic field. |
static String |
MAGNETIC_FLUX
The id for the Quantity object representing magnetic flux. |
static String |
MASS
The id for the Quantity object representing mass. |
static int |
MAX_REFERENCE_UNIT_LENGTH
The maximum length of the reference unit that can be stored in the database. |
static String |
MOMENTUM
The id for the Quantity object representing momentum. |
static String |
POTENTIAL
The id for the Quantity object representing electrical potential. |
static String |
POWER
The id for the Quantity object representing power. |
static String |
PRESSURE
The id for the Quantity object representing pressure. |
static String |
RADIOACTIVITY
The id for the Quantity object representing radioactivity. |
static String |
RESISTANCE
The id for the Quantity object representing electrical resistance. |
static String |
STORAGE_SIZE
The id for the Quantity object representing storage sizes. |
static String |
SUBSTANCE
The id for the Quantity object representing "amount
of substance". |
static String |
TEMPERATURE
The id for the Quantity object representing temperature. |
static String |
THERMAL_CONDUCTIVITY
The id for the Quantity object representing thermal conductivity. |
static String |
TIME
The id for the Quantity object representing time. |
static String |
TORGUE
The id for the Quantity object representing torque. |
static Item |
TYPE
The type of item represented by this class. |
static String |
VELOCITY
The id for the Quantity object representing velocity. |
static String |
VOLUME
The id for the Quantity object representing volume. |
Fields inherited from interface net.sf.basedb.core.Nameable |
---|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH |
Fields inherited from interface net.sf.basedb.core.SystemItem |
---|
MAX_SYSTEM_ID_LENGTH |
Constructor Summary | |
---|---|
Quantity(QuantityData data)
Creates a quantity item. |
Method Summary | |
---|---|
static Quantity |
getById(DbControl dc,
int id)
Get a Quantity object when you know the ID. |
String |
getDescription()
Get the description for the item. |
String |
getName()
Get the name of the item. |
static Quantity |
getNew(DbControl dc,
String referenceUnit)
Create a new Quantity item. |
static ItemQuery<Quantity> |
getQuery()
Get a query configured to retrieve quantities. |
String |
getReferenceUnit()
The reference unit describes the unit that all other units must relate to. |
String |
getSystemId()
Get the system id for the item. |
Item |
getType()
Get the type of item represented by the object. |
(package private) UnitData |
getUnit(org.hibernate.Session session,
String symbol)
Get the unit with a given symbol, or null if no unit is found. |
Unit |
getUnit(String symbol)
Get a a unit by symbol, also checking among the aliases. |
ItemQuery<Unit> |
getUnits()
Get a query that returns all units of this quantity. |
Set<ItemProxy> |
getUsingItems()
Get all: Unit :s for this quantity
AnnotationType :s using this quantity
|
(package private) void |
initPermissions(int granted,
int denied)
If this is a system quantity, delete and create permissions are revoked. |
boolean |
isRemoved()
Check if the removed flag is set for this item. |
boolean |
isSystemItem()
Check if the item is a system item or not. |
boolean |
isUsed()
Check if: Units for this quantity exists. |
void |
setDescription(String description)
Set the description for the item. |
void |
setName(String name)
Set the name of the item. |
void |
setReferenceUnit(String referenceUnit)
Sets the reference unit. |
void |
setRemoved(boolean removed)
Set the removed flag for this item. |
Methods inherited from class net.sf.basedb.core.BasicItem |
---|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.basedb.core.Identifiable |
---|
getId, getVersion |
Methods inherited from interface net.sf.basedb.core.AccessControlled |
---|
checkPermission, getPermissions, hasPermission |
Field Detail |
---|
public static final Item TYPE
Item.QUANTITY
,
getType()
public static final String LENGTH
Quantity
object representing length.
public static final String MASS
Quantity
object representing mass.
public static final String TIME
Quantity
object representing time.
public static final String TEMPERATURE
Quantity
object representing temperature.
public static final String CURRENT
Quantity
object representing electric current.
public static final String SUBSTANCE
Quantity
object representing "amount
of substance".
public static final String AREA
Quantity
object representing area.
public static final String VOLUME
Quantity
object representing volume.
public static final String VELOCITY
Quantity
object representing velocity.
public static final String ANGLE
Quantity
object representing angle.
public static final String FORCE
Quantity
object representing force.
public static final String FREQUENCY
Quantity
object representing frequency.
public static final String DENSITY
Quantity
object representing density.
public static final String ENERGY
Quantity
object representing energy.
public static final String POWER
Quantity
object representing power.
public static final String PRESSURE
Quantity
object representing pressure.
public static final String POTENTIAL
Quantity
object representing electrical potential.
public static final String RESISTANCE
Quantity
object representing electrical resistance.
public static final String CHARGE
Quantity
object representing electrical charge.
public static final String CAPACITANCE
Quantity
object representing capacitance.
public static final String MAGNETIC_FIELD
Quantity
object representing magnetic field.
public static final String MAGNETIC_FLUX
Quantity
object representing magnetic flux.
public static final String ABSORBED_DOSE
Quantity
object representing absorbed dose.
public static final String EQUIVALENT_DOSE
Quantity
object representing equivalent dose.
public static final String RADIOACTIVITY
Quantity
object representing radioactivity.
public static final String FRACTION
Quantity
object representing fractions.
public static final String ACCELERATION
Quantity
object representing acceleration.
public static final String TORGUE
Quantity
object representing torque.
public static final String MOMENTUM
Quantity
object representing momentum.
public static final String FLOW_RATE
Quantity
object representing flow rate.
public static final String THERMAL_CONDUCTIVITY
Quantity
object representing thermal conductivity.
public static final String STORAGE_SIZE
Quantity
object representing storage sizes.
public static final int MAX_REFERENCE_UNIT_LENGTH
setReferenceUnit(String)
,
Constant Field ValuesConstructor Detail |
---|
Quantity(QuantityData data)
data
- the dataMethod Detail |
---|
public static Quantity getNew(DbControl dc, String referenceUnit) throws BaseException
Quantity
item.
dc
- The DbControl
which will be used for
permission checking and database accessreferenceUnit
- The reference unit which all units must
relate to
Quantity
item
BaseException
- If there is an errorpublic static Quantity getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
Quantity
object when you know the ID.
dc
- The DbControl
which will be used for
permission checking and database access.id
- The system ID of the item to load.
Quantity
item
ItemNotFoundException
- This exception is thrown if an
item with the specified ID is not found
PermissionDeniedException
- This exception is thrown if
the logged in user doesn't have read
permission to the item
BaseException
- This exception is thrown if there is another
errorpublic static ItemQuery<Quantity> getQuery()
ItemQuery
objectpublic boolean isUsed() throws BaseException
isUsed
in class BasicItem<QuantityData>
BaseException
- If not able to tell if item is used or not.BasicItem.getUsingItems()
public Set<ItemProxy> getUsingItems()
Unit
:s for this quantity
AnnotationType
:s using this quantity
getUsingItems
in class BasicItem<QuantityData>
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)
void initPermissions(int granted, int denied) throws BaseException
initPermissions
in class BasicItem<QuantityData>
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass
BaseException
- If the permissions couldn't be initialisedpublic Item getType()
Identifiable
Item
enumeration.
getType
in interface Identifiable
public boolean isRemoved()
Removable
isRemoved
in interface Removable
public void setRemoved(boolean removed) throws PermissionDeniedException
Removable
setRemoved
in interface Removable
removed
- TRUE if the item should be flagged as removed,
FALSE otherwise
PermissionDeniedException
- If the logged in user doesn't
have Permission.DELETE
permission for setting the flag
to TRUE or Permission.WRITE
permission for setting the
flag to FALSEpublic String getSystemId()
SystemItem
getSystemId
in interface SystemItem
public boolean isSystemItem()
SystemItem
isSystemItem
in interface SystemItem
public String getName()
Nameable
getName
in interface Nameable
String
with the name of the itempublic void setName(String name) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_NAME_LENGTH
constant.
setName
in interface Nameable
name
- The new name for the item
PermissionDeniedException
- If the logged in user doesn't
have write permission
InvalidDataException
- If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH
constantpublic String getDescription()
Nameable
getDescription
in interface Nameable
String
with a description of the itempublic void setDescription(String description) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_DESCRIPTION_LENGTH
constant.
setDescription
in interface Nameable
description
- The new description for the item
PermissionDeniedException
- If the logged in user doesn't
have write permission
InvalidDataException
- If the description longer
than specified by the Nameable.MAX_DESCRIPTION_LENGTH
constantpublic String getReferenceUnit()
Unit.getReferenceFactor()
and
Unit.getReferenceOffset()
for a unit the following formula
should be used:
1 reference unit * factor + offset = 1 of the unitFor example:
1 meter * 0.001 + 0 = 1 millimeter 1 kelvin * 1 + 273.15 = 1 °Celsius
Unit.getReferenceFactor()
,
Unit.getReferenceOffset()
public void setReferenceUnit(String referenceUnit) throws PermissionDeniedException, InvalidDataException
referenceUnit
-
PermissionDeniedException
- If the logged in user doesn't
have write permission
InvalidDataException
- If the value is null, or longer than
MAX_REFERENCE_UNIT_LENGTH
public ItemQuery<Unit> getUnits()
ItemQuery
objectpublic Unit getUnit(String symbol)
UnitCache
instead which has better performance.
symbol
- The symbolUnitData getUnit(org.hibernate.Session session, String symbol)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |