2.17.2: 2011-06-17

net.sf.basedb.core
Class ArrayDesignBlock

java.lang.Object
  extended by net.sf.basedb.core.BasicItem<D>
      extended by net.sf.basedb.core.ChildItem<ArrayDesignBlockData>
          extended by net.sf.basedb.core.ArrayDesignBlock
All Implemented Interfaces:
AccessControlled, Identifiable

public class ArrayDesignBlock
extends ChildItem<ArrayDesignBlockData>

Version:
2.0
Author:
Enell
Last modified
$Date: 2010-01-19 13:20:05 +0100 (Tue, 19 Jan 2010) $

Field Summary
static Item TYPE
          The type of item represented by this class.
 
Constructor Summary
ArrayDesignBlock(ArrayDesignBlockData data)
           
 
Method Summary
 ArrayDesign getArrayDesign()
          Get the ArrayDesign that is linked with this block.
 int getBlockNumber()
          Get the block number of this block.
 int getBlockSizeX()
          Get the number of columns in this block.
 int getBlockSizeY()
          Get the number of rows in this block.
static ArrayDesignBlock getById(DbControl dc, int id)
          Get a ArrayDesignBlock object when you know the ID.
 int getFeatureDiameter()
          Get the expected diameter of spots on the slide.
 int getMetaGridX()
          Get the column coordinate of this block.
 int getMetaGridY()
          Get the row coordinate of this block.
(package private) static ArrayDesignBlock getNew(DbControl dc, ArrayDesign arrayDesign, BlockInfo blockInfo)
           
 int getOriginX()
          Get the distance from the left edge of the slide to the top left spot in the block.
 int getOriginY()
          Get the distance from the top edge of the slide to the top left spot in the block.
static ItemQuery<ArrayDesignBlock> getQuery(ArrayDesign arrayDesign)
          Get a query configured to retrieve array design blocks for the specified array design.
(package private)  SharedData getSharedParent()
          Get the shareable parent item of this child item.
 int getSpacingX()
          Get the x spacing between the spots in the slide.
 int getSpacingY()
          Get the y spacing between the spots in the slide.
 Item getType()
          Get the type of item represented by the object.
 Set<ItemProxy> getUsingItems()
          Get the array design this block is a part of.
 boolean hasFeatures()
          Checks if this ArrayDesignBlock has any features.
(package private)  void initPermissions(int granted, int denied)
          WRITE and DELETE permissions are always denied.
 boolean isUsed()
          Array design blocks are always used by an array design.
private  void setArrayDesign(ArrayDesign arrayDesign)
          Set the ArrayDesign for this block.
private  void setBlockNumber(int blockNumber)
          Set the block number of this block.
 void setBlockSizeX(int blockSizeX)
          Set the number of columns in this block.
 void setBlockSizeY(int blockSizeY)
          Set the number of rows in this block.
 void setFeatureDiameter(int diameter)
          Set the expected diameter of spots on the slide.
private  void setMetaGrid(int metaGridX, int metaGridY)
          Set the metagrid coordinates.
 void setOriginX(int originX)
          Set the distance from the left edge of the slide to the top left spot in this block.
 void setOriginY(int originY)
          Set the distance from the top edge of the slide to the top left spot in this block.
 void setSpacingX(int spacingX)
          Set the x spacing between the spots in the slide.
 void setSpacingY(int spacingY)
          Set the y spacing between the spots in the slide.
 
Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForWriteDeleteAndCreate, getPluginPermissions
 
Methods inherited from class net.sf.basedb.core.BasicItem
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, 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
 

Field Detail

TYPE

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

See Also:
Item.ARRAYDESIGNBLOCK, getType()
Constructor Detail

ArrayDesignBlock

ArrayDesignBlock(ArrayDesignBlockData data)
Method Detail

getNew

static ArrayDesignBlock getNew(DbControl dc,
                               ArrayDesign arrayDesign,
                               BlockInfo blockInfo)
                        throws BaseException
Throws:
BaseException

getById

public static ArrayDesignBlock getById(DbControl dc,
                                       int id)
                                throws ItemNotFoundException,
                                       PermissionDeniedException,
                                       BaseException
Get a ArrayDesignBlock object when you know the ID.

Parameters:
dc - The DbControl which will be used for permission checking and database access.
id - The ID of the item to load
Returns:
The ArrayDesignBlock item
Throws:
ItemNotFoundException - If an item with the specified ID is not found
PermissionDeniedException - If the logged in user doesn't have read permission to the items
BaseException - If there is another error

getQuery

public static ItemQuery<ArrayDesignBlock> getQuery(ArrayDesign arrayDesign)
Get a query configured to retrieve array design blocks for the specified array design.

Parameters:
arrayDesign - The array design to retreive blocks for, null is not allowed
Returns:
An ItemQuery object

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
Array design blocks are always used by an array design.

Overrides:
isUsed in class BasicItem<ArrayDesignBlockData>
Returns:
TRUE if this item is used, FALSE otherwise
Throws:
BaseException - If not able to tell if item is used or not.
See Also:
BasicItem.getUsingItems()

getUsingItems

public Set<ItemProxy> getUsingItems()
                             throws BaseException
Get the array design this block is a part of.

Overrides:
getUsingItems in class BasicItem<ArrayDesignBlockData>
Returns:
A set containing proxies for the items, or an empty set if no items are using this item
Throws:
BaseException - If there is an error loading the items
Since:
2.2
See Also:
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)

initPermissions

void initPermissions(int granted,
                     int denied)
               throws BaseException
WRITE and DELETE permissions are always denied.

Overrides:
initPermissions in class ChildItem<ArrayDesignBlockData>
Parameters:
granted - Permissions that have been granted by the subclass
denied - Permissions that have been denied by the subclass
Throws:
BaseException - If the permissions couldn't be initialised

getSharedParent

SharedData getSharedParent()
Description copied from class: ChildItem
Get the shareable parent item of this child item. This is used by the ChildItem.initPermissions(int, int) method to calculate the logged in user's permissions for the child item.

Specified by:
getSharedParent in class ChildItem<ArrayDesignBlockData>
Returns:
The parent item

getArrayDesign

public ArrayDesign getArrayDesign()
                           throws PermissionDeniedException,
                                  BaseException
Get the ArrayDesign that is linked with this block.

Returns:
An ArrayDesign item
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to the item
BaseException - This exception is thrown if there is another error

setArrayDesign

private void setArrayDesign(ArrayDesign arrayDesign)
                     throws InvalidDataException
Set the ArrayDesign for this block.

Throws:
InvalidDataException

getMetaGridX

public int getMetaGridX()
Get the column coordinate of this block.

Returns:
the column coordinate

getMetaGridY

public int getMetaGridY()
Get the row coordinate of this block.

Returns:
the row coordinate

setMetaGrid

private void setMetaGrid(int metaGridX,
                         int metaGridY)
                  throws InvalidDataException
Set the metagrid coordinates. If the coordinates are unknown the both should be set to 0 otherwise the coordinates must be greater then 0.

Parameters:
metaGridX - the column coordinate
Throws:
InvalidDataException

getBlockNumber

public int getBlockNumber()
Get the block number of this block.

Returns:
The number of this block.

setBlockNumber

private void setBlockNumber(int blockNumber)
                     throws InvalidDataException
Set the block number of this block.

Parameters:
blockNumber - the block number of this block
Throws:
InvalidDataException - if the blocknumber is less then 1

getBlockSizeX

public int getBlockSizeX()
Get the number of columns in this block.

Returns:
the number of columns in this block.

setBlockSizeX

public void setBlockSizeX(int blockSizeX)
                   throws InvalidDataException
Set the number of columns in this block. Must be greater then 0.

Parameters:
blockSizeX - the number of rows in this block.
Throws:
InvalidDataException - if blockSizeX is less then 1

getBlockSizeY

public int getBlockSizeY()
Get the number of rows in this block.

Returns:
the number of rows in this block

setBlockSizeY

public void setBlockSizeY(int blockSizeY)
                   throws InvalidDataException
Set the number of rows in this block. Must be greater then 0.

Parameters:
blockSizeY - the number of columns in this block.
Throws:
InvalidDataException - if blockSizeY is less then 1

getOriginX

public int getOriginX()
Get the distance from the left edge of the slide to the top left spot in the block.

Returns:
the distance from the edge

setOriginX

public void setOriginX(int originX)
                throws InvalidDataException
Set the distance from the left edge of the slide to the top left spot in this block.

Parameters:
originX - the distance from the edge
Throws:
InvalidDataException - if originX is less then 0

getOriginY

public int getOriginY()
Get the distance from the top edge of the slide to the top left spot in the block.

Returns:
the distance from the edge

setOriginY

public void setOriginY(int originY)
                throws InvalidDataException
Set the distance from the top edge of the slide to the top left spot in this block.

Parameters:
originY - the distance from the edge
Throws:
InvalidDataException - if originY is less then 0

getSpacingX

public int getSpacingX()
Get the x spacing between the spots in the slide.

Returns:
the spacing between the spots

setSpacingX

public void setSpacingX(int spacingX)
                 throws InvalidDataException
Set the x spacing between the spots in the slide.

Parameters:
spacingX - the spacing between the spots
Throws:
InvalidDataException - if spacingX is less then 0

getSpacingY

public int getSpacingY()
Get the y spacing between the spots in the slide.

Returns:
the spacing between the spots

setSpacingY

public void setSpacingY(int spacingY)
                 throws InvalidDataException
Set the y spacing between the spots in the slide.

Parameters:
spacingY - the spacing between the spots
Throws:
InvalidDataException - if spacingY is less then 0

getFeatureDiameter

public int getFeatureDiameter()
Get the expected diameter of spots on the slide.

Returns:
The expected diameter.
Since:
2.7

setFeatureDiameter

public void setFeatureDiameter(int diameter)
                        throws InvalidDataException
Set the expected diameter of spots on the slide.

Parameters:
diameter - The expected diameter
Throws:
InvalidDataException - If the diameter is less then 0

hasFeatures

public boolean hasFeatures()
Checks if this ArrayDesignBlock has any features.

Returns:
TRUE if the AraryDesignBlock has any fetures

2.17.2: 2011-06-17