Last update: 2011-06-23

org.proteios.core
Class Hardware

java.lang.Object
  extended by org.proteios.core.BasicItem<D>
      extended by org.proteios.core.OwnedItem<D>
          extended by org.proteios.core.SharedItem<D>
              extended by org.proteios.core.CommonItem<HardwareData>
                  extended by org.proteios.core.Hardware
All Implemented Interfaces:
AccessControlled, Identifiable, Nameable, Ownable, Removable, Shareable

public class Hardware
extends CommonItem<HardwareData>

This class is used to represent individual hardware items and information about them. In the current version of Proteios the only type of hardware we keep information about is scanners.

Version:
2.0
Author:
enell
See Also:
HardwareType
Last modified
$Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Field Summary
static int MAX_VERSIONSTRING_LENGTH
          The maximum length of the version variable that can be stored in the database.
static Item TYPE
          The type of item represented by this class.
 
Fields inherited from interface org.proteios.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
 
Method Summary
 HardwareType getHardwareType()
          Get the associated HardwareType item.
static ItemQuery<Hardware> getQuery()
          Get a query configured to retrieve hardware.
 Item getType()
          Get the type of item represented by the object.
 String getVersionString()
          Get the versionstring of this Hardware item.
 boolean isUsed()
          Check if: a Scan is linked to this hardware
 void setHardwareType(HardwareType hardwareType)
          Set the HardwareType of this Hardware item.
 void setVersionString(String versionString)
          Set the versionstring for this Hardware item.
 
Methods inherited from class org.proteios.core.CommonItem
getDescription, getName, isRemoved, setDescription, setName, setRemoved
 
Methods inherited from class org.proteios.core.SharedItem
getItemKey, getProjectKey, isShared, setItemKey, setProjectKey
 
Methods inherited from class org.proteios.core.OwnedItem
getOwner, setOwner
 
Methods inherited from class org.proteios.core.BasicItem
checkPermission, equals, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.proteios.core.Identifiable
getId, getVersion
 
Methods inherited from interface org.proteios.core.AccessControlled
checkPermission, hasPermission
 
Methods inherited from interface org.proteios.core.Ownable
getOwner, setOwner
 

Field Detail

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.HARDWARE, getType()

MAX_VERSIONSTRING_LENGTH

public static final int MAX_VERSIONSTRING_LENGTH
The maximum length of the version variable that can be stored in the database. Check the length against this value before calling the setVersionString(String) method to avoid exceptions.

See Also:
Constant Field Values
Method Detail

getQuery

public static ItemQuery<Hardware> getQuery()
                                    throws BaseException
Get a query configured to retrieve hardware.

Returns:
An ItemQuery object
Throws:
BaseException

getType

public Item getType()
Description copied from interface: Identifiable
Get the type of item represented by the object. The returned value is one of the values defined in the Item enumeration.

Returns:
A value indicating the type of item

isUsed

public boolean isUsed()
               throws BaseException
Check if:

Specified by:
isUsed in class BasicItem<HardwareData>
Returns:
TRUE if this hardware is used.
Throws:
BaseException - if there is any error.

getHardwareType

public HardwareType getHardwareType()
                             throws PermissionDeniedException,
                                    BaseException
Get the associated HardwareType item. All Hardware items must have a type.

Returns:
The HardwareType item
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.READ permission to the item
BaseException - If there is any error

setHardwareType

public void setHardwareType(HardwareType hardwareType)
                     throws PermissionDeniedException,
                            InvalidUseOfNullException
Set the HardwareType of this Hardware item. This parameter mustn't be null.

Parameters:
hardwareType - The new HardwareType
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.WRITE permission for the hardware or Permission.USE permission for the hardware type
InvalidUseOfNullException - If the hardware type is null

getVersionString

public String getVersionString()
Get the versionstring of this Hardware item.

Returns:
A string with the version of this item, or null if not known

setVersionString

public void setVersionString(String versionString)
                      throws StringTooLongException,
                             PermissionDeniedException
Set the versionstring for this Hardware item. The value must not be longer than the value specified by the MAX_VERSIONSTRING_LENGTH constant.

Parameters:
versionString - The new version for this item, or null if not known
Throws:
StringTooLongException - If versionString is longer then MAX_VERSIONSTRING_LENGTH
PermissionDeniedException - If the logged in user don't have write permission on this item

Last update: 2011-06-23