public class Quantity extends BasicItem implements Nameable, SystemItem, Removable
Unit
,
Essentials of
the SI: Base & derived unitsModifier and Type | Field and Description |
---|---|
static java.lang.String |
ABSORBED_DOSE
The id for the
Quantity object representing absorbed dose. |
static java.lang.String |
ACCELERATION
The id for the
Quantity object representing acceleration. |
static java.lang.String |
ANGLE
The id for the
Quantity object representing angle. |
static java.lang.String |
AREA
The id for the
Quantity object representing area. |
static java.lang.String |
CAPACITANCE
The id for the
Quantity object representing capacitance. |
static java.lang.String |
CHARGE
The id for the
Quantity object representing electrical charge. |
static java.lang.String |
CURRENT
The id for the
Quantity object representing electric current. |
static java.lang.String |
DENSITY
The id for the
Quantity object representing density. |
static java.lang.String |
ENERGY
The id for the
Quantity object representing energy. |
static java.lang.String |
EQUIVALENT_DOSE
The id for the
Quantity object representing equivalent dose. |
static java.lang.String |
FLOW_RATE
The id for the
Quantity object representing flow rate. |
static java.lang.String |
FORCE
The id for the
Quantity object representing force. |
static java.lang.String |
FRACTION
The id for the
Quantity object representing fractions. |
static java.lang.String |
FREQUENCY
The id for the
Quantity object representing frequency. |
static java.lang.String |
LENGTH
The id for the
Quantity object representing length. |
static java.lang.String |
MAGNETIC_FIELD
The id for the
Quantity object representing magnetic field. |
static java.lang.String |
MAGNETIC_FLUX
The id for the
Quantity object representing magnetic flux. |
static java.lang.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 java.lang.String |
MOLAR_CONCENTRATION
The id for the
Quantity object representing substance concentration. |
static java.lang.String |
MOMENTUM
The id for the
Quantity object representing momentum. |
static java.lang.String |
POTENTIAL
The id for the
Quantity object representing electrical potential. |
static java.lang.String |
POWER
The id for the
Quantity object representing power. |
static java.lang.String |
PRESSURE
The id for the
Quantity object representing pressure. |
static java.lang.String |
RADIOACTIVITY
The id for the
Quantity object representing radioactivity. |
static java.lang.String |
RESISTANCE
The id for the
Quantity object representing electrical resistance. |
static java.lang.String |
STORAGE_SIZE
The id for the
Quantity object representing storage sizes. |
static java.lang.String |
SUBSTANCE
The id for the
Quantity object representing "amount
of substance". |
static java.lang.String |
TEMPERATURE
The id for the
Quantity object representing temperature. |
static java.lang.String |
THERMAL_CONDUCTIVITY
The id for the
Quantity object representing thermal conductivity. |
static java.lang.String |
TIME
The id for the
Quantity object representing time. |
static java.lang.String |
TORGUE
The id for the
Quantity object representing torque. |
static Item |
TYPE
The type of item represented by this class.
|
static java.lang.String |
VELOCITY
The id for the
Quantity object representing velocity. |
static java.lang.String |
VOLUME
The id for the
Quantity object representing volume. |
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
MAX_SYSTEM_ID_LENGTH
Constructor and Description |
---|
Quantity(QuantityData data)
Creates a quantity item.
|
Modifier and Type | Method and Description |
---|---|
static Quantity |
getById(DbControl dc,
int id)
Get a
Quantity object when you know the ID. |
(package private) QuantityData |
getData()
Get the
BasicData object that holds all data for this item. |
java.lang.String |
getDescription()
Get the description for the item.
|
java.lang.String |
getName()
Get the name of the item.
|
static Quantity |
getNew(DbControl dc,
java.lang.String referenceUnit)
Create a new
Quantity item. |
static ItemQuery<Quantity> |
getQuery()
Get a query configured to retrieve quantities.
|
java.lang.String |
getReferenceUnit()
The reference unit describes the unit that all other units must
relate to.
|
User |
getRemovedBy()
Get the user that flagged this item for removal.
|
java.lang.String |
getSystemId()
Get the system id for the item.
|
Item |
getType()
Get the type of item represented by the object.
|
(package private) UnitData |
getUnit(Session session,
java.lang.String symbol)
Get the unit with a given symbol, or null if no unit is found.
|
Unit |
getUnit(java.lang.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.
|
java.util.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(java.lang.String description)
Set the description for the item.
|
void |
setName(java.lang.String name)
Set the name of the item.
|
void |
setReferenceUnit(java.lang.String referenceUnit)
Sets the reference unit.
|
void |
setRemoved(boolean removed)
Set the removed flag for this item.
|
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getVersion
checkPermission, getPermissions, hasPermission
public static final Item TYPE
Item.QUANTITY
,
getType()
public static final java.lang.String LENGTH
Quantity
object representing length.public static final java.lang.String MASS
Quantity
object representing mass.public static final java.lang.String TIME
Quantity
object representing time.public static final java.lang.String TEMPERATURE
Quantity
object representing temperature.public static final java.lang.String CURRENT
Quantity
object representing electric current.public static final java.lang.String SUBSTANCE
Quantity
object representing "amount
of substance".public static final java.lang.String AREA
Quantity
object representing area.public static final java.lang.String VOLUME
Quantity
object representing volume.public static final java.lang.String VELOCITY
Quantity
object representing velocity.public static final java.lang.String ANGLE
Quantity
object representing angle.public static final java.lang.String FORCE
Quantity
object representing force.public static final java.lang.String FREQUENCY
Quantity
object representing frequency.public static final java.lang.String DENSITY
Quantity
object representing density.public static final java.lang.String ENERGY
Quantity
object representing energy.public static final java.lang.String POWER
Quantity
object representing power.public static final java.lang.String PRESSURE
Quantity
object representing pressure.public static final java.lang.String POTENTIAL
Quantity
object representing electrical potential.public static final java.lang.String RESISTANCE
Quantity
object representing electrical resistance.public static final java.lang.String CHARGE
Quantity
object representing electrical charge.public static final java.lang.String CAPACITANCE
Quantity
object representing capacitance.public static final java.lang.String MAGNETIC_FIELD
Quantity
object representing magnetic field.public static final java.lang.String MAGNETIC_FLUX
Quantity
object representing magnetic flux.public static final java.lang.String ABSORBED_DOSE
Quantity
object representing absorbed dose.public static final java.lang.String EQUIVALENT_DOSE
Quantity
object representing equivalent dose.public static final java.lang.String RADIOACTIVITY
Quantity
object representing radioactivity.public static final java.lang.String FRACTION
Quantity
object representing fractions.public static final java.lang.String ACCELERATION
Quantity
object representing acceleration.public static final java.lang.String TORGUE
Quantity
object representing torque.public static final java.lang.String MOMENTUM
Quantity
object representing momentum.public static final java.lang.String FLOW_RATE
Quantity
object representing flow rate.public static final java.lang.String THERMAL_CONDUCTIVITY
Quantity
object representing thermal conductivity.public static final java.lang.String STORAGE_SIZE
Quantity
object representing storage sizes.public static final java.lang.String MOLAR_CONCENTRATION
Quantity
object representing substance concentration.public static final int MAX_REFERENCE_UNIT_LENGTH
setReferenceUnit(String)
,
Constant Field ValuesQuantity(QuantityData data)
data
- the datapublic static Quantity getNew(DbControl dc, java.lang.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 toQuantity
itemBaseException
- 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
itemItemNotFoundException
- This exception is thrown if an
item with the specified ID is not foundPermissionDeniedException
- This exception is thrown if
the logged in user doesn't have read
permission to the itemBaseException
- This exception is thrown if there is another
errorpublic static ItemQuery<Quantity> getQuery()
ItemQuery
objectQuantityData getData()
BasicItem
BasicData
object that holds all data for this item.public boolean isUsed() throws BaseException
isUsed
in class BasicItem
BaseException
- If not able to tell if item is used or not.BasicItem.getUsingItems()
public java.util.Set<ItemProxy> getUsingItems()
Unit
:s for this quantity
AnnotationType
:s using this quantity
getUsingItems
in class BasicItem
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)
void initPermissions(int granted, int denied) throws BaseException
initPermissions
in class BasicItem
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclassBaseException
- If the permissions couldn't be initialisedpublic Item getType()
Identifiable
Item
enumeration.getType
in interface Identifiable
public boolean isRemoved()
Removable
public void setRemoved(boolean removed) throws PermissionDeniedException
Removable
setRemoved
in interface Removable
removed
- TRUE if the item should be flagged as removed,
FALSE otherwisePermissionDeniedException
- 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 User getRemovedBy() throws PermissionDeniedException, ItemNotFoundException
Removable
getRemovedBy
in interface Removable
PermissionDeniedException
- If the logged in user doesn't have
Permission.READ
permission for the userItemNotFoundException
- If the user that removed this item
can't be foundpublic java.lang.String getSystemId()
SystemItem
getSystemId
in interface SystemItem
public boolean isSystemItem()
SystemItem
isSystemItem
in interface SystemItem
public java.lang.String getName()
Nameable
public void setName(java.lang.String name) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_NAME_LENGTH
constant.setName
in interface Nameable
name
- The new name for the itemPermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH
constantpublic java.lang.String getDescription()
Nameable
getDescription
in interface Nameable
String
with a description of the itempublic void setDescription(java.lang.String description) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_DESCRIPTION_LENGTH
constant.setDescription
in interface Nameable
description
- The new description for the itemPermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the description longer
than specified by the Nameable.MAX_DESCRIPTION_LENGTH
constantpublic java.lang.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
public void setReferenceUnit(java.lang.String referenceUnit) throws PermissionDeniedException, InvalidDataException
PermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the value is null, or longer than
MAX_REFERENCE_UNIT_LENGTH
public ItemQuery<Unit> getUnits()
ItemQuery
objectpublic Unit getUnit(java.lang.String symbol)
UnitCache
instead which has better performance.symbol
- The symbol