Package net.sf.basedb.core
Class ArrayDesignBlock
- java.lang.Object
-
- net.sf.basedb.core.BasicItem
-
- net.sf.basedb.core.ChildItem
-
- net.sf.basedb.core.ArrayDesignBlock
-
- All Implemented Interfaces:
AccessControlled
,Identifiable
public class ArrayDesignBlock extends ChildItem
- Version:
- 2.0
- Author:
- Enell
- Last modified
- $Date: 2015-04-17 14:02:22 +0200 (fr, 17 apr 2015) $
-
-
Constructor Summary
Constructors Constructor Description ArrayDesignBlock(ArrayDesignBlockData data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayDesign
getArrayDesign()
Get theArrayDesign
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 aArrayDesignBlock
object when you know the ID.(package private) ArrayDesignBlockData
getData()
Get theBasicData
object that holds all data for this item.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 thisArrayDesignBlock
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 theArrayDesign
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
getPermissionForUse, getPermissionForWriteDeleteAndCreate, getPluginPermissions
-
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
-
-
-
-
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 aArrayDesignBlock
object when you know the ID.- Parameters:
dc
- TheDbControl
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 foundPermissionDeniedException
- If the logged in user doesn't have read permission to the itemsBaseException
- 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
-
getData
ArrayDesignBlockData getData()
Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.
-
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 theItem
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 classBasicItem
- 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 classBasicItem
- 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.Query)
-
initPermissions
void initPermissions(int granted, int denied) throws BaseException
WRITE and DELETE permissions are always denied.- Overrides:
initPermissions
in classChildItem
- Parameters:
granted
- Permissions that have been granted by the subclassdenied
- 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 theChildItem.initPermissions(int, int)
method to calculate the logged in user's permissions for the child item.- Specified by:
getSharedParent
in classChildItem
- Returns:
- The parent item
-
getArrayDesign
public ArrayDesign getArrayDesign() throws PermissionDeniedException, BaseException
Get theArrayDesign
that is linked with this block.- Returns:
- An
ArrayDesign
item - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the itemBaseException
- This exception is thrown if there is another error
-
setArrayDesign
private void setArrayDesign(ArrayDesign arrayDesign) throws InvalidDataException
Set theArrayDesign
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 thisArrayDesignBlock
has any features.- Returns:
- TRUE if the AraryDesignBlock has any fetures
-
-